Skip to content

Some keys do not get recognized on non-US keyboard layouts #47

@Bone008

Description

@Bone008

Describe the bug

After the fix for #40, some keys still don't get through, for example the German ä. I tracked it down to all keys which are in the _KEYCODE_MAP and different from the US layout. The ä key has keycode 222, which is ' on US keyboards, so that's what the library maps it to due to characterFromEvent(...) using event.which before accessing event.key.

I believe _KEYCODE_MAP should no longer be necessary and now does more harm than good, since event.key properly handles all special character transformations in a layout-aware fashion. There may be some edge cases I have missed, though.

Expected behavior:

Registering this shortcut should work when pressing the "ä" key on a German keyboard:

{ key: "ä", command: () => alert('test') }

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Firefox 71
  • Version: 8.2.0

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions