From e6f2b1a94aef037c40851d8ffd5d575c9b88a4f1 Mon Sep 17 00:00:00 2001 From: ella Date: Tue, 4 Aug 2026 13:45:39 -0700 Subject: [PATCH 1/4] Remove the editableRoot opt-in from the paragraph block Cross-block editing through an engaged editing host is not ready for WordPress 7.0 RC1: focus and selection still misbehave around nested block lists. No block opts in now, so the host machinery stays dormant until the block list host redesign proves itself. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01XrG35JQKJBX1iNof5wtfjN --- packages/block-library/src/paragraph/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/block-library/src/paragraph/index.js b/packages/block-library/src/paragraph/index.js index b3d66b336e1872..0b9a10ee35c190 100644 --- a/packages/block-library/src/paragraph/index.js +++ b/packages/block-library/src/paragraph/index.js @@ -16,7 +16,7 @@ import save from './save'; import transforms from './transforms'; import { unlock } from '../lock-unlock'; -const { fieldsKey, formKey, editableRootKey } = unlock( blocksPrivateApis ); +const { fieldsKey, formKey } = unlock( blocksPrivateApis ); const { name } = metadata; @@ -24,9 +24,6 @@ export { metadata, name }; export const settings = { icon, - // Opt into the editing host behaviour privately. It's a Symbol setting - // rather than a public `supports` key so it stays an internal detail. - [ editableRootKey ]: true, example: { attributes: { content: __( From c68a0757b72e5a0af46e802e79ed6d044448cc3f Mon Sep 17 00:00:00 2001 From: ella Date: Tue, 4 Aug 2026 13:52:31 -0700 Subject: [PATCH 2/4] Assert the dormant host semantics in the e2e specs With no block opting into editableRoot, the canvas wrapper hosts editing only during a cross-block selection. Update the host semantics test accordingly and remove the host mode spec, which exercised the paragraph opt-in. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01XrG35JQKJBX1iNof5wtfjN --- .../editor/various/editable-root.spec.js | 69 ------------------- .../various/multi-block-selection.spec.js | 28 +++----- 2 files changed, 8 insertions(+), 89 deletions(-) delete mode 100644 test/e2e/specs/editor/various/editable-root.spec.js diff --git a/test/e2e/specs/editor/various/editable-root.spec.js b/test/e2e/specs/editor/various/editable-root.spec.js deleted file mode 100644 index b947ee843dae0e..00000000000000 --- a/test/e2e/specs/editor/various/editable-root.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * WordPress dependencies - */ -const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); - -test.describe( 'editableRoot host mode', () => { - test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); - } ); - - test( 'wrapper becomes the editing host for a paragraph with siblings', async ( { - editor, - page, - } ) => { - await editor.insertBlock( { - name: 'core/paragraph', - attributes: { content: 'a' }, - } ); - await editor.insertBlock( { - name: 'core/paragraph', - attributes: { content: 'b' }, - } ); - await page.keyboard.press( 'ArrowUp' ); - - // Host mode: the selected block has a contentEditable ancestor above it - // (the canvas wrapper), which does not happen when the block is edited - // on its own element. - await expect - .poll( () => - editor.canvas - .locator( ':root' ) - .evaluate( - ( root ) => - !! root.ownerDocument.querySelector( - '[contenteditable="true"] [data-block]' - ) - ) - ) - .toBe( true ); - } ); - - test( 'a heading (no support) is not hosted', async ( { - editor, - page, - } ) => { - await editor.insertBlock( { - name: 'core/heading', - attributes: { content: 'a' }, - } ); - await editor.insertBlock( { - name: 'core/heading', - attributes: { content: 'b' }, - } ); - await page.keyboard.press( 'ArrowUp' ); - - await expect - .poll( () => - editor.canvas - .locator( ':root' ) - .evaluate( - ( root ) => - !! root.ownerDocument.querySelector( - '[contenteditable="true"] [data-block]' - ) - ) - ) - .toBe( false ); - } ); -} ); diff --git a/test/e2e/specs/editor/various/multi-block-selection.spec.js b/test/e2e/specs/editor/various/multi-block-selection.spec.js index 5e1c61783a7c49..3a733d82cbec63 100644 --- a/test/e2e/specs/editor/various/multi-block-selection.spec.js +++ b/test/e2e/specs/editor/various/multi-block-selection.spec.js @@ -241,7 +241,7 @@ test.describe( 'Multi-block selection (@firefox, @webkit)', () => { .toEqual( [ 1 ] ); } ); - test( 'should keep the editing host semantics across a cross-block selection', async ( { + test( 'should present the editing host semantics during a cross-block selection', async ( { page, editor, pageUtils, @@ -253,16 +253,13 @@ test.describe( 'Multi-block selection (@firefox, @webkit)', () => { await page.keyboard.press( 'Enter' ); await page.keyboard.type( '2' ); - // The wrapper hosts editing for the selected block: it must present - // as a named multiline textbox for as long as it is the editing - // host, including while a selection crosses blocks. + // Without a cross-block selection, the block is edited on its own + // element and the canvas wrapper is not an editing host. const host = editor.canvas.locator( 'body' ); - await expect( host ).toHaveAttribute( 'contenteditable', 'true' ); - await expect( host ).toHaveAttribute( 'role', 'textbox' ); - await expect( host ).toHaveAttribute( 'aria-multiline', 'true' ); - await expect( host ).toHaveAttribute( 'aria-label', 'Editor canvas' ); + await expect( host ).not.toHaveAttribute( 'contenteditable', 'true' ); - // Extend the selection across blocks: the host semantics remain. + // Extend the selection across blocks: the wrapper becomes the + // editing host and must present as a named multiline textbox. await pageUtils.pressKeys( 'shift+ArrowUp' ); await expect .poll( () => @@ -281,18 +278,9 @@ test.describe( 'Multi-block selection (@firefox, @webkit)', () => { 'Multiple selected blocks' ); - // Collapse into a block: the block still hosts, so the semantics - // remain and the generic host name returns. - await page.keyboard.press( 'ArrowLeft' ); - await expect( host ).toHaveAttribute( 'contenteditable', 'true' ); - await expect( host ).toHaveAttribute( 'role', 'textbox' ); - await expect( host ).toHaveAttribute( 'aria-label', 'Editor canvas' ); - - // Move to the post title: the editability and the textbox semantics + // Collapse into a block: the editability and the textbox semantics // are removed together. - await editor.canvas - .getByRole( 'textbox', { name: 'Add title' } ) - .click(); + await page.keyboard.press( 'ArrowLeft' ); await expect( host ).toHaveAttribute( 'contenteditable', 'false' ); await expect( host ).not.toHaveAttribute( 'role' ); await expect( host ).not.toHaveAttribute( 'aria-multiline' ); From 6f8e740510ae4b345b0262f00e72a69242723248 Mon Sep 17 00:00:00 2001 From: ella Date: Tue, 4 Aug 2026 14:43:27 -0700 Subject: [PATCH 3/4] Remove the remaining tests of the editing host behavior The autocomplete spec asserted the suggestions list ARIA references mirrored onto the engaged host, and the compatibility spec exercised the event bridging for block wrapperProps handlers. Both test the behavior no block opts into now. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01XrG35JQKJBX1iNof5wtfjN --- .../various/autocomplete-and-mentions.spec.js | 63 ---- .../various/editable-root-compat.spec.js | 296 ------------------ 2 files changed, 359 deletions(-) delete mode 100644 test/e2e/specs/editor/various/editable-root-compat.spec.js diff --git a/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js b/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js index 91ffb282bdb5e8..03b933d43704b6 100644 --- a/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js +++ b/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js @@ -736,69 +736,6 @@ test.describe( 'Autocomplete (@firefox, @webkit)', () => { await expect( page.getByRole( 'listbox' ) ).toBeHidden(); } ); - test( 'should mirror the suggestions list reference onto the editing host', async ( { - editor, - page, - } ) => { - // The editing host, which `RichText` mirrors these attributes onto by - // hand, only takes over once the block has a sibling. - await editor.canvas - .getByRole( 'button', { name: 'Add default block' } ) - .click(); - await page.keyboard.type( 'A first paragraph.' ); - await page.keyboard.press( 'Enter' ); - await page.keyboard.type( 'hello @fr' ); - - await expect( - page.getByRole( 'option', { - name: 'Frodo Baggins', - selected: true, - } ) - ).toBeVisible(); - - const editingHost = editor.canvas.getByRole( 'textbox', { - name: 'Editor canvas', - } ); - - // The popover renders outside the canvas, so the list is mirrored back - // into it — these IDs have to resolve in the host's own document. - const listBoxId = await editor.canvas - .getByRole( 'listbox' ) - .getAttribute( 'id' ); - const optionId = await editor.canvas - .getByRole( 'option', { name: 'Frodo Baggins' } ) - .getAttribute( 'id' ); - - await expect( editingHost ).toHaveAttribute( - 'aria-autocomplete', - 'list' - ); - await expect( editingHost ).toHaveAttribute( - 'aria-haspopup', - 'listbox' - ); - await expect( editingHost ).toHaveAttribute( - 'aria-controls', - listBoxId - ); - await expect( editingHost ).toHaveAttribute( 'aria-owns', listBoxId ); - await expect( editingHost ).toHaveAttribute( - 'aria-activedescendant', - optionId - ); - - await page.keyboard.press( 'Escape' ); - await expect( page.getByRole( 'listbox' ) ).toBeHidden(); - - // Only an omitted value clears an attribute here: a `null` would land - // on the host as the string "null". - await expect( editingHost ).not.toHaveAttribute( 'aria-controls' ); - await expect( editingHost ).not.toHaveAttribute( 'aria-owns' ); - await expect( editingHost ).not.toHaveAttribute( - 'aria-activedescendant' - ); - } ); - test( 'should re-trigger autocomplete when backspacing into a completed mention', async ( { editor, page, diff --git a/test/e2e/specs/editor/various/editable-root-compat.spec.js b/test/e2e/specs/editor/various/editable-root-compat.spec.js deleted file mode 100644 index b3faed45aee334..00000000000000 --- a/test/e2e/specs/editor/various/editable-root-compat.spec.js +++ /dev/null @@ -1,296 +0,0 @@ -/** - * WordPress dependencies - */ -const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); - -test.describe( 'Editable root block event handler compatibility', () => { - test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); - } ); - - test( 'delivers keyboard events to a block wrapperProps handler', async ( { - editor, - page, - } ) => { - // A third party adds an event handler to every block through - // wrapperProps, the surface host mode would otherwise bypass. - await page.evaluate( () => { - window.__extKeys = []; - const { createElement } = window.wp.element; - window.wp.hooks.addFilter( - 'editor.BlockListBlock', - 'test/compat-events', - ( BlockListBlock ) => ( props ) => - createElement( BlockListBlock, { - ...props, - wrapperProps: { - ...props.wrapperProps, - onKeyDown: ( event ) => - window.__extKeys.push( event.key ), - }, - } ) - ); - } ); - - await editor.insertBlock( { - name: 'core/paragraph', - attributes: { content: 'a' }, - } ); - await editor.insertBlock( { - name: 'core/paragraph', - attributes: { content: 'b' }, - } ); - - // Move to the first paragraph so the wrapper becomes the editing host. - await page.keyboard.press( 'ArrowUp' ); - - await page.evaluate( () => ( window.__extKeys = [] ) ); - await page.keyboard.type( 'x' ); - - await expect - .poll( () => page.evaluate( () => window.__extKeys ) ) - .toContain( 'x' ); - } ); - - test( 'lets a block wrapperProps handler cancel the default action', async ( { - editor, - page, - } ) => { - await page.evaluate( () => { - const { createElement } = window.wp.element; - window.wp.hooks.addFilter( - 'editor.BlockListBlock', - 'test/compat-events-prevent', - ( BlockListBlock ) => ( props ) => - createElement( BlockListBlock, { - ...props, - wrapperProps: { - ...props.wrapperProps, - onKeyDown: ( event ) => { - if ( event.key === 'b' ) { - event.preventDefault(); - } - }, - }, - } ) - ); - } ); - - await editor.insertBlock( { - name: 'core/paragraph', - attributes: { content: 'a' }, - } ); - await editor.insertBlock( { - name: 'core/paragraph', - attributes: { content: 'a' }, - } ); - - await page.keyboard.press( 'ArrowUp' ); - await page.keyboard.press( 'End' ); - - // 'a' types; 'b' is canceled by the handler. - await page.keyboard.type( 'ab' ); - - const [ firstParagraph ] = await editor.getBlocks(); - expect( firstParagraph.attributes.content ).toBe( 'aa' ); - } ); - - test( 'passes a synthetic-like event with a working nativeEvent', async ( { - editor, - page, - } ) => { - await page.evaluate( () => { - window.__extInput = []; - const { createElement } = window.wp.element; - window.wp.hooks.addFilter( - 'editor.BlockListBlock', - 'test/compat-events-synthetic', - ( BlockListBlock ) => ( props ) => - createElement( BlockListBlock, { - ...props, - wrapperProps: { - ...props.wrapperProps, - onBeforeInput: ( event ) => { - window.__extInput.push( { - data: event.data, - isSynthetic: - typeof event.persist === 'function', - nativeEventType: - event.nativeEvent?.constructor?.name, - isDefaultPrevented: - event.isDefaultPrevented(), - // The real event is wrapped, so these - // are faithful, not a scripted copy's. - isTrusted: event.isTrusted, - // Not on React's synthetic event, so - // reached through the native event. - hasTargetRanges: - event.nativeEvent.getTargetRanges() - .length > 0, - } ); - }, - }, - } ) - ); - } ); - - await editor.insertBlock( { - name: 'core/paragraph', - attributes: { content: 'a' }, - } ); - await editor.insertBlock( { - name: 'core/paragraph', - attributes: { content: 'b' }, - } ); - await page.keyboard.press( 'ArrowUp' ); - await page.evaluate( () => ( window.__extInput = [] ) ); - await page.keyboard.type( 'x' ); - - const record = await page - .evaluate( () => window.__extInput ) - .then( ( entries ) => entries.at( -1 ) ); - expect( record ).toMatchObject( { - data: 'x', - isSynthetic: true, - nativeEventType: 'InputEvent', - isDefaultPrevented: false, - isTrusted: true, - hasTargetRanges: true, - } ); - } ); - - test( 'stops propagation between nested block handlers', async ( { - editor, - page, - } ) => { - // The inner (list item) handler stops propagation; the outer (list) - // handler must not see the event, like React bubbling. - await page.evaluate( () => { - window.__extPath = []; - const { createElement } = window.wp.element; - window.wp.hooks.addFilter( - 'editor.BlockListBlock', - 'test/compat-events-nested', - ( BlockListBlock ) => ( props ) => - createElement( BlockListBlock, { - ...props, - wrapperProps: { - ...props.wrapperProps, - onKeyDown: ( event ) => { - window.__extPath.push( props.block.name ); - if ( props.block.name === 'core/list-item' ) { - event.stopPropagation(); - } - }, - }, - } ) - ); - } ); - - await editor.insertBlock( { - name: 'core/list', - innerBlocks: [ - { - name: 'core/list-item', - attributes: { content: 'item' }, - }, - { - name: 'core/list-item', - attributes: { content: 'item two' }, - }, - ], - } ); - - // Select the first list item so the wrapper hosts. - await editor.canvas - .getByRole( 'textbox', { name: 'List text' } ) - .first() - .click(); - await page.evaluate( () => ( window.__extPath = [] ) ); - await page.keyboard.type( 'x' ); - - await expect - .poll( () => page.evaluate( () => window.__extPath ) ) - .toEqual( [ 'core/list-item' ] ); - } ); - - test( 'delivers input events to a block wrapperProps handler', async ( { - editor, - page, - } ) => { - await page.evaluate( () => { - window.__extInputData = []; - const { createElement } = window.wp.element; - window.wp.hooks.addFilter( - 'editor.BlockListBlock', - 'test/compat-events-input', - ( BlockListBlock ) => ( props ) => - createElement( BlockListBlock, { - ...props, - wrapperProps: { - ...props.wrapperProps, - onInput: ( event ) => - window.__extInputData.push( event.data ), - }, - } ) - ); - } ); - - await editor.insertBlock( { - name: 'core/paragraph', - attributes: { content: 'a' }, - } ); - await editor.insertBlock( { - name: 'core/paragraph', - attributes: { content: 'b' }, - } ); - - await page.keyboard.press( 'ArrowUp' ); - await page.evaluate( () => ( window.__extInputData = [] ) ); - await page.keyboard.type( 'x' ); - - await expect - .poll( () => page.evaluate( () => window.__extInputData ) ) - .toContain( 'x' ); - } ); - - test( 'does not double up an event React already delivers', async ( { - editor, - page, - } ) => { - // The code block is plain text, not part of the rich-text writing flow, - // so it will never be an editableRoot host: React delivers the event to - // the block as usual. The host bridge must recognise the event isn't on - // the host and stay out of the way, so the handler runs once, not twice. - await page.evaluate( () => { - window.__extCount = 0; - const { createElement } = window.wp.element; - window.wp.hooks.addFilter( - 'editor.BlockListBlock', - 'test/compat-events-count', - ( BlockListBlock ) => ( props ) => - createElement( BlockListBlock, { - ...props, - wrapperProps: { - ...props.wrapperProps, - onKeyDown: () => ( window.__extCount += 1 ), - }, - } ) - ); - } ); - - await editor.insertBlock( { - name: 'core/code', - attributes: { content: 'a' }, - } ); - - await page.evaluate( () => ( window.__extCount = 0 ) ); - await page.keyboard.press( 'x' ); - - // One keydown, one call. A second would mean the bridge fired on top of - // React's delivery. - await expect - .poll( () => page.evaluate( () => window.__extCount ) ) - .toBe( 1 ); - } ); -} ); From 702d691aa808f5b8ff612a31e0e57d89c217633e Mon Sep 17 00:00:00 2001 From: ella Date: Tue, 4 Aug 2026 16:47:36 -0700 Subject: [PATCH 4/4] Keep the site tagline out of the site title assertion The settings spec saves the tagline 'Just another Gutenberg site' and never restores it. Removing spec files reshuffled the Playwright shards, so it now runs before the template activation spec, whose site title locator getByText( 'gutenberg' ) then also matches the tagline and fails on the ambiguity. Match the title exactly, and restore the tagline after the settings test. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01XrG35JQKJBX1iNof5wtfjN --- test/e2e/specs/editor/various/core-settings.spec.js | 12 +++++++++--- test/e2e/specs/site-editor/template-activate.spec.js | 7 ++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/test/e2e/specs/editor/various/core-settings.spec.js b/test/e2e/specs/editor/various/core-settings.spec.js index 9dddc273e6b16e..363fa96dbc454b 100644 --- a/test/e2e/specs/editor/various/core-settings.spec.js +++ b/test/e2e/specs/editor/various/core-settings.spec.js @@ -32,9 +32,9 @@ test.describe( 'Settings', () => { ); await admin.visitAdminPage( 'options-general.php' ); - await page - .getByRole( 'textbox', { name: 'Tagline' } ) - .fill( 'Just another Gutenberg site' ); + const taglineField = page.getByRole( 'textbox', { name: 'Tagline' } ); + const originalTagline = await taglineField.inputValue(); + await taglineField.fill( 'Just another Gutenberg site' ); await page.getByRole( 'button', { name: 'Save Changes' } ).click(); const optionsAfter = await getOptionsValues( @@ -48,5 +48,11 @@ test.describe( 'Settings', () => { const optionAfter = [ id, optionsAfter[ id ] ]; expect( optionAfter ).toStrictEqual( optionBefore ); } ); + + // Restore the tagline: other tests render it through the site + // tagline block, and the changed value would leak into them. + await admin.visitAdminPage( 'options-general.php' ); + await taglineField.fill( originalTagline ); + await page.getByRole( 'button', { name: 'Save Changes' } ).click(); } ); } ); diff --git a/test/e2e/specs/site-editor/template-activate.spec.js b/test/e2e/specs/site-editor/template-activate.spec.js index 19b9a448ea4d22..75aefee07719f6 100644 --- a/test/e2e/specs/site-editor/template-activate.spec.js +++ b/test/e2e/specs/site-editor/template-activate.spec.js @@ -77,7 +77,12 @@ test.describe( 'Template Activate', () => { .first() .click(); - await expect( editor.canvas.getByText( 'gutenberg' ) ).toBeVisible(); + // The site title, rendered by the header template part. Exact, so a + // site tagline containing the word does not make the locator + // ambiguous. + await expect( + editor.canvas.getByText( 'gutenberg', { exact: true } ) + ).toBeVisible(); await editor.insertBlock( { name: 'core/paragraph',