-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some keyboard shortcuts steal focus from modal dialogs #55899
Comments
Thanks for sharing the issue, Here’s the screencast of the issue for a quick overview: Screen.Recording.2025-02-13.at.11.47.37.AM.mov |
I wanted to add another shortcut this surfaces with is the region navigation shortcut 😢. Also a related issue #41503. I had tried fixing the above by having Modal make all other content inert #53829 (which would likely fix this too) but ran across a rather obscure bug that seemed like a blocker. Every so often the inert content would remain inert even after the attribute was removed. It seemed like an actual browser bug. I should probably revisit and see if it still happens. |
@stokesman yes the reason why |
Makes sense. Thanks for highlighting that issue.
I wanted to report that PR keeps focus from moving out of the modal for these shortcuts I’ve tested:
Undo and redo can still escape the focus trap. The editor’s iframe is somehow able to gain focus despite being inside of an Another route to avoiding this issue would be disabling keyboard shortcuts while a modal is open. Some discussion on how to approach disabling shortcuts is in #18755. An API could be added to the keyboard-shortcuts package and used throughout Gutenberg’s modals. That would leave third-party use of modals with this potential pitfall. There is a more general solution that could be applied to the base |
Description
Discovered while investigating #55894
When a modal dialog is open, no other UI should be perceivable or be interacted with. The purpose of a modal dialog is, in fact, to prevent interaction with the rest of the UI.
However, some actions that are available via keyboard shortcuts, do steal focus from an open modal dialog. This should never happen. Focus should always stay within a modal dialog until users explicitly want to close the modal dialog.
Step-by-step reproduction instructions
aria-hidden="true"
to be made 'inert'.Screenshots, screen recording, code snippet
No response
Environment info
No response
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
The text was updated successfully, but these errors were encountered: