Skip to content
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

Editor loses focus after keyboard shortcut to switch to code editor #42145

Open
MatzeKitt opened this issue Jul 5, 2022 · 3 comments
Open

Editor loses focus after keyboard shortcut to switch to code editor #42145

MatzeKitt opened this issue Jul 5, 2022 · 3 comments
Labels
[Feature] Code Editor Handling the code view of the editing experience [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended

Comments

@MatzeKitt
Copy link
Contributor

Description

If I swith to the code editor via keyboard shortcut, I cannot switch right back afterwards via keyboard shortcut, since the editor loses the focus. I need to click inside the code editor to switch back to the visual editor.

If the more menu is open on the upper right corner of the editor, I can switch between both editors with keyboard shortcuts every time.

Step-by-step reproduction instructions

  1. Open a post/page edit page in the backend.
  2. Click into the editor to get focus.
  3. Press the keyboard shortcut to switch to the code editor.
  4. Press the same keyboard shortcut again.

Screenshots, screen recording, code snippet

No response

Environment info

WordPress 6.0
No Gutenberg plugin installed
Safari 15.5
macOS 12.4

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

No

@Mamaduka
Copy link
Member

Mamaduka commented Jul 5, 2022

Probably related #40577.

@Mamaduka Mamaduka added the [Feature] Code Editor Handling the code view of the editing experience label Jul 5, 2022
@afercia afercia added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended labels Jul 18, 2023
@afercia
Copy link
Contributor

afercia commented Jul 18, 2023

Adding some more context from #52719 (closed as duplicate).

Actually there are two problems with this:

  1. For keyboard users and assistive technology users a focus loss is a terrible experience as they are 'catapulted' back to the document root and they have to start navigating the page from scratch.
  2. When a full focus loss occurs, all the Editor keyboard shortcuts don't work any longer. For example Cmd+K to open the command center doesn't do anything. See Command Center: Keyboard Focus lost when toggling Editor Preferences or Code Editor #52301

Please see #52719 for some additional considerations.

@Mamaduka
Copy link
Member

When/if code highlighting of the currently selected block is implemented (#26738), we can use it as a new target for the focus.

At the moment, I think @afercia's suggestion from #52719 (comment) could work as a middle ground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Code Editor Handling the code view of the editing experience [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants