You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Focus loss when closing the Create pattern dialog opened from the block toolbar #78952
Some commands in the block toolbar 'Options' menu open a modal dialog.
When the modal dialog is open, the expectation is that pressing the Escape key will close the dialog and retur focus back to the item in the menu that opened it.
This works for all the 'Options" menu items except the 'Create pattern' one.
Screenshot ot the block toolbar 'Options' menu items to be tested:
Step-by-step reproduction instructions
Create a post, add a Paragraph block.
From the block toolbar open the 'Options' menu.
Test the following items in the menu, you can either click on them or use the keyboard to move to them and press Enter.
Click 'Lock'. A modal dialog opens.
Press the Escape key. The dialog closes and focus is moved back to the trigger, as expected.
Click 'Rename'. A modal dialog opens.
Press the Escape key. The dialog closes and focus is moved back to the trigger, as expected.
Click 'Hide'. A modal dialog opens.
Press the Escape key. The dialog closes and focus is moved back to the trigger, as expected.
Click 'Create pattern'. A modal dialog opens.
Press the Escape key. The dialog closes. Observe the Options menu closes as well. Observe there is a focus loss.
Screenshots, screen recording, code snippet
No response
Environment info
WordPress trunk 7.1-alpha-62161-src
Gutenberg 23.3.1 (trunk)
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Please confirm which theme type you used for testing.
Video recording to illustrate the focus loss.
Observe that after the menu closes unexpectedly, pressing the Tab key re-starts the tab order from the document root.
Hi! I've identified the root cause of this focus loss issue. It's in packages/patterns/src/components/pattern-convert-button.js — the onClose callback for the CreatePatternModal incorrectly calls closeBlockSettingsMenu() when the modal is dismissed, which closes the entire Options dropdown and leaves focus stranded. Other dialogs in the same menu (Lock, Rename, Hide) only close the modal on dismiss, leaving the dropdown open for focus to return naturally. I'm working on a fix.
Activity
afercia commentedon Jun 4, 2026
Video recording to illustrate the focus loss.
Observe that after the menu closes unexpectedly, pressing the Tab key re-starts the tab order from the document root.
Screen.Recording.2026-06-04.at.16.39.22.mov
Mustafabharmal commentedon Jun 4, 2026
Hi! I've identified the root cause of this focus loss issue. It's in
packages/patterns/src/components/pattern-convert-button.js— theonClosecallback for theCreatePatternModalincorrectly callscloseBlockSettingsMenu()when the modal is dismissed, which closes the entire Options dropdown and leaves focus stranded. Other dialogs in the same menu (Lock, Rename, Hide) only close the modal on dismiss, leaving the dropdown open for focus to return naturally. I'm working on a fix.