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
CMD + OPTOIN + SHIFT + M not exiting code editor #49841
The combination of keys to show the code editor is the same as the one to exit it.
CMD + OPTOIN + SHIFT + M (on Mac)
If you use it to enter into the code view and you hit the exact key combination again, it won't exit it.
It forces you to first focus the editor so you have to click with the mouse somewhere and then hit the keys.
I feel like this shouldn't behave this way.
The editor should be focused by default when changing the view so we can use the key combination and toggle between both views faster.
Step-by-step reproduction instructions
Create a blog post
Hit CMD + OPTOIN + SHIFT + M to enter into the code view
Try to hit again CMD + OPTOIN + SHIFT + M to exit it
Notice it won't work unless you click somewhere on the editor before hitting CMD + OPTOIN + SHIFT + M again.
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.
This is a known limitation; the editor area should have a focus so that the keyboard shortcuts work. See #45151 (comment).
We might want to open a general issue to consider two options @youknowriad mentioned. The new issue also can be used as a reference for future reports.
Thanks for the report, @alvarotrigo. This works now on WordPress 7.1.2 with Gutenberg trunk (built 2026-10-16). Cmd+Option+Shift+M switches to the code editor and moves focus into it (the title field gets focus since #54718), so pressing the same shortcut again goes straight back to the visual editor without clicking. It also switched back when focus was outside the editor. If you still see this, please reopen with the steps you used.
Activity
Thelmachido commentedon Apr 14, 2023
I was able to replicate this, if you don't click around the code editor the shortcut doesn't work.
Enviroment
WordPress 6.2
Gutenberg 15.5.1
TT3 theme
Mamaduka commentedon Apr 15, 2023
This is a known limitation; the editor area should have a focus so that the keyboard shortcuts work. See #45151 (comment).
We might want to open a general issue to consider two options @youknowriad mentioned. The new issue also can be used as a reference for future reports.
youknowriad commentedon Oct 22, 2026
Thanks for the report, @alvarotrigo. This works now on WordPress 7.1.2 with Gutenberg trunk (built 2026-10-16). Cmd+Option+Shift+M switches to the code editor and moves focus into it (the title field gets focus since #54718), so pressing the same shortcut again goes straight back to the visual editor without clicking. It also switched back when focus was outside the editor. If you still see this, please reopen with the steps you used.
alvarotrigo commentedon Oct 22, 2026
Thanks @youknowriad ! 👍