Skip to content

Commit

Permalink
Writing flow: fix selecting synced pattern (#55221)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Oct 11, 2023
1 parent c04dadb commit c423023
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ export function getClosestTabbable(
}

function isTabCandidate( node ) {
if ( node.closest( '[inert]' ) ) {
return;
}

// Skip if there's only one child that is content editable (and thus a
// better candidate).
if (
Expand Down
23 changes: 23 additions & 0 deletions test/e2e/specs/editor/various/writing-flow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,29 @@ test.describe( 'Writing Flow (@firefox, @webkit)', () => {
)
).toHaveText( /^.a+$/ );
} );

test( 'should select synced pattern', async ( { page, editor } ) => {
await page.keyboard.press( 'Enter' );
await page.keyboard.type( 'synced' );

await editor.clickBlockOptionsMenuItem( 'Create pattern' );
await page.keyboard.press( 'Tab' );
await page.keyboard.press( 'Tab' );
await page.keyboard.type( 'test' );
await page.keyboard.press( 'Enter' );

await expect(
editor.canvas.locator( '[data-type="core/block"]' )
).toBeFocused();

await editor.insertBlock( { name: 'core/paragraph' } );

await page.keyboard.press( 'ArrowUp' );

await expect(
editor.canvas.locator( '[data-type="core/block"]' )
).toBeFocused();
} );
} );

class WritingFlowUtils {
Expand Down

0 comments on commit c423023

Please sign in to comment.