Skip to content

Focus loss when closing the Create pattern dialog opened from the block toolbar #78952

@afercia

Description

@afercia

Description

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:

Image

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.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Labels

[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions