-
Notifications
You must be signed in to change notification settings - Fork 117
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] Pressing modifier keys while other keys is held triggers other key, and prevents other keys #1115
Comments
Yes, this is currently "by design". The hook listens to every keystroke and saves all currently held keys. If another key is pressed it looks at all held down keys and triggers each callback that matches. Otherwise combinations like Thanks for raising this. |
Thanks for the explanation. I should explain a bit more why this is a problem with a real-world example. Our project has some modal hotkeys and this behaviour interferes. For example, while While A common use pattern is to activate the move tool with Unfortunately this doesn't work with the current behaviour, because the hook reports a I suppose I could use e.g. |
Yes I agree. This hook wasn't intended to be used in such complicated scenarios, haha, but I'll gladly improve it to get to work for this example. But it is not that simple to implement and would be a breaking change. So this needs to go into version 5. |
Hi @psychedelicious ! we have ran into similar issues, have you found a workaround / fix / different package that solves it for you? |
Hi @StefKors , in places where I needed more control, I have just used In case this is helpful for you, here are some notes for how I went about managing some hotkeys:
Hope that's helpful. |
@psychedelicious Wow that's super helpful! thanks for sharing, I was already bitten by not having blur events. |
Describe the bug
When a key is held down and a modifier key is pressed, the first key triggers.
To Reproduce
https://codesandbox.io/p/sandbox/long-waterfall-r3v76q?file=%2Fsrc%2FApp.tsx%3A21%2C3
Listeners are attached to window for "space" and also for the hook, logging to console on call
Expected behavior
The behaviour should be the same as the window listener. Callbacks should not be called when a modifier is pressed.
I tried
ignoreModifiers
but that didn't change anything - I don't think we'd expect it to anyways base on my understanding of that optionDesktop (please complete the following information):
Additional context
I tried versions 4.4.0, 4.4.1, 4.4.2 and 4.4.3 and they all seem to have the same issue.
The text was updated successfully, but these errors were encountered: