Skip to content

Most Default Commands don’t work on a non-QWERTY Keyboard #28

@amxmln

Description

@amxmln

I have a QWERTZ keyboard and am unable to use the following default commands:

  • Ctrl+Enter (Cmd+Enter on MacOS): Insert blank line
  • Ctrl+[ (Cmd+[ on MacOS): Outdent line
  • Ctrl+] (Cmd+] on MacOS): Indent line
  • Ctrl+/ (Cmd+/ on MacOS): Toggle comment
  • Shift+Alt+A: Toggle block comment

While the first four simply do not work (even when using the physical keys representing the keyCodes used in the source, probably because native features override them), the last one does add a block comment, but instead of the text it only contains the letter Å, so for example language: 'html', becomes /* Å */.

The first undo restores the original text, but commented out, the second undo removes the comment.

These issues are inherent to using KeyboardEvent.code / KeyboardEvent.keyCode instead of KeyboardEvent.key. Unfortunately, KeyboardEvent.key isn’t reliable as soon as the Shift- or Option-keys on Mac are involved, as that triggers different return values for KeyboardEvent.key, so I’m not quite sure how that could be fixed.

Unfortunately, I also couldn’t find an option to easily remap most of the default commands, as they’re added via a keydown listener, not via the keyCommandMap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions