jaywcjlove / hotkeys-js

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

support for non english keyboards #395

Open goleary opened 2 years ago

goleary commented 2 years ago

Thanks for a super useful library!

I have a hot key, /. It works well on English keyboards, but does not work on Spanish keyboards. On Spanish keyboards the / character is typed by pressing shift+7.

Thing is the keypress event indicates event.key === '/' so I'm not sure why hotkeys isn't able to recognize it.

The workaround I'm using for now is creating two hotkeys, one for / & the other for shift+7, but this is suboptimal, and next time one of my users complains about the hotkey not working for them I'll likely have to add another hotkey.

Is there any reason why the event.key is not used for matching the hotkey?

This StackBliz demonstrates the issue.