Skip to content

CMD + OPTOIN + SHIFT + M not exiting code editor  #49841

Closed

Description

@alvarotrigo

Description

The combination of keys to show the code editor is the same as the one to exit it.
CMD + OPTOIN + SHIFT + M (on Mac)

image

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

  1. Create a blog post
  2. Hit CMD + OPTOIN + SHIFT + M to enter into the code view
  3. 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.

Yes

Activity

  1. Thelmachido commented on Apr 14, 2023

    @Thelmachido

    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

  2. Mamaduka commented on Apr 15, 2023

    @Mamaduka
    Member

    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.

  3. youknowriad commented on Oct 22, 2026

    @youknowriad
    Contributor

    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.

  4. alvarotrigo commented on Oct 22, 2026

    @alvarotrigo
    Author

    Thanks @youknowriad ! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions