JohannesKlauss / react-hotkeys-hook

React hook for using keyboard shortcuts in components.
https://react-hotkeys-hook.vercel.app/
MIT License
2.56k stars 112 forks source link

[BUG] `+` / Plus key not registering #1186

Closed KieranTH closed 1 week ago

KieranTH commented 1 week ago

Describe the bug Any combination including a plus does not fire. This also happens when the combination key is changed to something other than plus to make sure there is no conflict from the string parsing.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/p/sandbox/pedantic-goldberg-9tv8xd
  2. Attempt to use "alt.+" as combination
  3. Fails to register

Expected behavior The hotkey should be triggered when a plus is included, a general usage for this is additional/additive actions, such as alt and + to increase a number etc.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

JohannesKlauss commented 1 week ago

You have to change your splitKey (which is + by default) to listen to that key: https://react-hotkeys-hook.vercel.app/docs/api/use-hotkeys#splitkey

KieranTH commented 1 week ago

Great thank you!