-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Command Center: Keyboard Focus lost when toggling Editor Preferences or Code Editor #52301
Comments
In regards to the Editor Preferences, I think it depends on how you close the Modal. Using the close button or pressing Esc should maintain focus as expected. Clicking outside the modal drops it #51722. For the Code Editor, I confirm it doesn't matter how you engage/disengage (keyboard shortcut or Options menu) focus is lost. |
I find this also happens when opening/closing the Command Center/Palette with the mouse. after triggering the command palette by clicking in the title bar at the top, and then clicking outside the palette to remove it - the main window no longer had focus - so the keyboard command would not work. |
@afercia @alexstine @joedolson in case any of you can test and provide feedback here <3 |
Yes, I can confirm that this happens. The focus is handled on Also, I don't understand why the command center doesn't have a close button. |
I'd second this. All modal dialogs should always have a CLose button. The Modal component dos provide it by default but it has an option to hide the dialog header, including the Close button. There are other cases of modal dialogs where the dialog header is hidden, I guess only for visual design purposes. Regarding this specific issue: Switching between Visual editor and Code editorFocus should stay in the most appropriate place but there are two different cases to consider:
Implementing some proper focus management would solve the Cmd+K shortcut issue. Modal dialogsThe Modal component default behavior is:
Worth noting that this impacts any keyboard shortcut, not only Cmd+K. When focus is lost, no element in the main window has focus. Other shortcuts e.g. Control+Option+H won't work. Overall:
|
For reference: the modal dialog 'focus on close' management is handled by useFocusReturn from the |
Adding to to do in 6.3. Thank you all for the feedback and testing! |
Andrea’s breakdown of this is great 👏 . I'll make a PR later today for the return of focus from modals. The Code Editor part should probably be a separate effort. |
Thank you @stokesman |
Description
When toggling panels like the Editor Preferences or Code Editor - the editor no longer has focus once those are closed, so the keyboard shortcut for the Command Center doesn't work.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
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: