Skip to content
Source
Sign inSign up
TanStack/hotkeys

Hotkey registering both for the `key` and `code` fields for normal characters #17

Closedfuegoio(GitHub profile, opens in a new tab) opened this issue 1 comment

TanStack Hotkeys version

0.1.0

Framework/Library version

React v19

Describe the bug and the steps to reproduce it

Hi!

Thanks a lot for this library, I was quite unhappy with react-hotkeys-hook. The issue that I am having is that by also matching the hotkey on the event.code, with a different keyboard layout (I'm in Dvorak myself), the hotkey will be triggered on two keys: the layout-produced key, and the hardware key, which is not an expected and wanted behavior.

I agree with the behavior of matching the code for digits and characters with modifiers (like on MacOS), but I think this should be opt-in for some hotkeys as the normal behavior of matching a simple key like useHotkey("C", ...) will produce weird results on lot of users.

https://stackblitz.com/edit/bolt-vite-react-z3br3ops?file=src%2FApp.tsx

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

Yes, I think I know how to fix it and will discuss it in the comments of this issue

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
  1. Yep, same issue here, also because I use dvorak.

  2. KevinVandy closed this

Sign in to join this conversation.