From 155bf84f725e69d30483c465385474f73d646692 Mon Sep 17 00:00:00 2001 From: Alec Geatches Date: Thu, 16 Jul 2026 11:51:15 -0600 Subject: [PATCH 1/3] Fix tabs test by excluding parent 'Tab Panels' name and counting all panels --- test/e2e/specs/editor/blocks/tabs.spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/e2e/specs/editor/blocks/tabs.spec.js b/test/e2e/specs/editor/blocks/tabs.spec.js index 5935b98915fb16..52d5fbe2403c4c 100644 --- a/test/e2e/specs/editor/blocks/tabs.spec.js +++ b/test/e2e/specs/editor/blocks/tabs.spec.js @@ -166,6 +166,8 @@ test.describe( 'Tabs', () => { // The new tab's panel is the active one and is visible. const panels = editor.canvas.getByRole( 'document', { name: 'Block: Tab Panel', + exact: true, + includeHidden: true, } ); await expect( panels ).toHaveCount( 3 ); await expect( panels.nth( 2 ) ).toBeVisible(); From 842f67e7da6ac52f0cb30352d8d2c23afb164191 Mon Sep 17 00:00:00 2001 From: Alec Geatches Date: Thu, 16 Jul 2026 11:52:33 -0600 Subject: [PATCH 2/3] Extend comment on test fix --- test/e2e/specs/editor/blocks/tabs.spec.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/e2e/specs/editor/blocks/tabs.spec.js b/test/e2e/specs/editor/blocks/tabs.spec.js index 52d5fbe2403c4c..48ee010574a013 100644 --- a/test/e2e/specs/editor/blocks/tabs.spec.js +++ b/test/e2e/specs/editor/blocks/tabs.spec.js @@ -164,6 +164,9 @@ test.describe( 'Tabs', () => { ).toBeFocused(); // The new tab's panel is the active one and is visible. + // Use `exact: true` to avoid matching the parent 'Block: Tab Panels' name. + // Use `includeHidden: true` to check the number of hidden panels. getByRole() + // only returns visible elements by default. const panels = editor.canvas.getByRole( 'document', { name: 'Block: Tab Panel', exact: true, From e2d18199d715cc6b45587e49d8dd7028fe40dd74 Mon Sep 17 00:00:00 2001 From: Alec Geatches Date: Thu, 16 Jul 2026 13:37:33 -0600 Subject: [PATCH 3/3] Fix home/end handling in tabs on mac chromium --- .../components/writing-flow/use-home-end.js | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/block-editor/src/components/writing-flow/use-home-end.js b/packages/block-editor/src/components/writing-flow/use-home-end.js index a3641dcccc4967..ce8d6a1b7a2369 100644 --- a/packages/block-editor/src/components/writing-flow/use-home-end.js +++ b/packages/block-editor/src/components/writing-flow/use-home-end.js @@ -12,10 +12,16 @@ import { getSelectionEditableElement } from '../../utils/dom'; import { store as blockEditorStore } from '../../store'; /** - * While the wrapper is the contentEditable editing host (a selected block - * supports `editableRoot`), browsers don't perform the default caret - * movement for Home and End. Perform the equivalent movement with - * `Selection.modify()`. + * Moves the caret to the start or end of the visual line for Home and End + * with `Selection.modify()`, because the browser's default caret movement + * cannot be relied on in two cases: + * + * - While the wrapper is the contentEditable editing host (a selected block + * supports `editableRoot`), browsers don't perform the default caret + * movement for Home and End. + * - Chromium on macOS maps Home and End to scroll commands, so it never + * moves the caret in editable content on that platform, including nested + * editable elements like the tab labels in the tab-list block. */ export default function useHomeEnd() { const { hasMultiSelection } = useSelect( blockEditorStore ); @@ -33,11 +39,13 @@ export default function useHomeEnd() { return; } - if ( - node.contentEditable !== 'true' || - node.ownerDocument.activeElement !== node || - hasMultiSelection() - ) { + // Only handle keys pressed in editable content, in both of the + // cases mentioned above: `event.target` is the focused element, + // and `isContentEditable` is true both for the wrapper as the + // editing host and for a nested editable element like a tab label. + // Anything else that takes focus like inputs and textareas keep + // default behavior. + if ( ! event.target.isContentEditable || hasMultiSelection() ) { return; }