jaywcjlove / hotkeys-js

➷ A robust Javascript library for capturing keyboard input. It has no dependencies.
https://jaywcjlove.github.io/hotkeys-js
MIT License
6.66k stars 410 forks source link

Setting "ArrowLeft" key binds to "a" #311

Closed ghost closed 3 years ago

ghost commented 3 years ago

When trying to bind to arrow keys, like ArrowLeft, ArrowDown, ArrowRight, ArrowUp, the letter "A" ends up being bound to.

example hotkeys("ArrowLeft", callback)

Currently, it seems that you need to bind to "*" and check the key being pressed. This is somewhat of a problem when you want to unbind, as now you're forced to unbind everything and might unbind things that should persist.

Is there a means to do this differently that I am missing? If not, would be handy to differentiate better.

ghost commented 3 years ago

Seems https://github.com/jaywcjlove/hotkeys/issues/13 you're supposed to use "right" "left" "up" "down". Easy to miss in docs