Some keys do not get recognized on non-US keyboard layouts
Bone008 opened this issue · comments
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