github / hotkey

Trigger an action on an element with a keyboard shortcut.
https://github.github.com/hotkey/
MIT License
3.22k stars 97 forks source link

fix: support for meta+shift plane while retaining short upper chars #26

Closed keithamus closed 4 years ago

keithamus commented 4 years ago

I raised https://github.com/github/hotkey/pull/25 in the hopes of adding support for the meta+shift plane, but this broke shortcuts like data-key=B because it is expecting data-key=Shift+B. The tests were passing because our tests have capitals without shiftKey = true.

This fixes the breakage in 1.3.1 by adding a check to only add the Shift+ modifier if event.key.toUpperCase() !== event.key, allowing for both data-key="Meta+Shift+b"/data-key="B"