hotkeys-js
hotkeys-js copied to clipboard
when alt/option (or even shift) key is used, the event.key is not what it should be
I noticed if you press the p then the event.key is p
I noticed if you press shift+p then the event.key is P
and if you press alt+p then the event.key is π
In all 3 cases the event.code is KeyP and the event.keyCode is 80
I would expect that the event.key should be simply p in all 3 cases above. I would like to be able to alert('you have pressed __') to print out alt-p, but currently I cannot achieve this without doing some additional processing, converting somehow KeyP or 80 to p
The actual key pressed, in this case p, should be readily available to hotkeys even when the modifier keys are used
I found a workaround which is to use String.fromCharCode(event.keyCode) instead of event.key