Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] isHotkeyPressed does not recognize arrow keys (ex: "ArrowLeft"), but useHotkeys does #1099

Open
perspectivezoom opened this issue Nov 27, 2023 · 0 comments

Comments

@perspectivezoom
Copy link

Describe the bug
See codesandbox: https://codesandbox.io/p/sandbox/modern-bush-9z75c6?file=%2Fsrc%2FApp.js (Forked from the codesandbox in #766 but with the react-hotkeys-hook package version bumped to 4.4.1)

  • isHotkeyPressed("LeftArrow") does not seem to work.
  • useHotkeys("LeftArrow", () => ...) does work.
  • isHotkeyPressed("shift") does work.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/p/sandbox/modern-bush-9z75c6?file=%2Fsrc%2FApp.js
  2. Click on button. Observe no increment.
  3. Hold shift, click on button. Observe an increment.
  4. Hold LeftArrow on keyboard. Observe that the useHotkeys detected LeftArrow being pressed.
  5. While LeftArrow is still pressed, click on the button. Be confused why there is no increment.

Expected behavior
For the button to increment when left arrow is held down, just like shift.

Screenshots
Screen Shot 2023-11-27 at 1 25 02 AM

Desktop (please complete the following information):

  • OS: MacOS Monterey 12.5.1
  • Browser Observed in both Firefox 120 and Chrome 119.0.6045.159
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant