You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you add a shortcut d that triggers action A and shortcut g+d that triggers action B.
useHotkeys("d", A);
useHotkeys("g+d", B);
Pressing d only triggers action A. But if you press g+d both action A and B get triggered.
I would expect this behavior if I had inverted the first shortcut to d+g since there is a time where I am pressing solely the d key and therefore I would expect action A to get triggered.
But I don't see why the library wouldn't be able to tell that when I am pressing key g and d at the same time the action that should be triggered is that of g+d/ action B.
Repro
I created a reproduction sandbox with some other shortcuts that also don't work as you would expect.
If you add a shortcut
d
that triggers actionA
and shortcutg+d
that triggers actionB
.Pressing
d
only triggers actionA
. But if you pressg+d
both actionA
andB
get triggered.I would expect this behavior if I had inverted the first shortcut to
d+g
since there is a time where I am pressing solely thed
key and therefore I would expect actionA
to get triggered.But I don't see why the library wouldn't be able to tell that when I am pressing key
g
andd
at the same time the action that should be triggered is that ofg+d
/ actionB
.Repro
I created a reproduction sandbox with some other shortcuts that also don't work as you would expect.
https://codesandbox.io/s/react-hotkeys-firing-events-with-same-key-t3kdqq
I also tried playing with the new
useKey
property in v5 but that didn't fix the issue.Related issues
I've checked out #1005 and I initially thought this would be tied to the order of the keys not mattering, but decided to create it's own issue.
EDIT: I am now just seeing #677 which I think is this exact same issue. Happy to close this in favor of that issue.
Solution
For now I'm just changing which shortcuts I use.
But if this is something that could be addressed I would be happy to help making a PR.
The text was updated successfully, but these errors were encountered: