-
Notifications
You must be signed in to change notification settings - Fork 110
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] Switching to colemak causes multiple keystrokes to be registered. #1039
Comments
We're seeing this issue too in our app! |
Yes, this is related to this issue. I am working on a version 5 that only listens to the produced key. But I am super busy right now, so this might take some time. |
This is a layout specific problem that gets addressed in version 5. This has been fixed in pre release 5.0.0-1. Please try out this version. Please let me know if that fixes your issue. |
@JohannesKlauss I tried In Dvorak layout if I press function Test() {
const [countH, setCountH] = React.useState(0);
const [countD, setCountD] = React.useState(0);
hotkeys.useHotkeys('d', () => setCountD((count) => count + 1), { useKey: true });
// In dvorak pressing the 'h' key is the same as pressing the 'd' key in qwerty
hotkeys.useHotkeys('h', () => setCountH((count) => count + 1), { useKey: true });
return (
<>
<h1>Pressed D key {countD} times.</h1>
<h1>Pressed H key {countH} times.</h1>
</>
);
} |
That is weird. If you log the event, what is the produced key? |
Both events have the same: |
Hmh... but in general the Keys work correct (in a textinput for example?) |
yeah, that works fine. The issue is seeing 2 events fired when pressing only 1 key. In my app I have actions associated with |
What happens if you add a third one with the following and hit useHotkeys('*', e => console.log(e)) Can you show me the logs? |
Yeah, no problem. I did and when pressing |
Describe the bug
Multiple keystrokes registered with colemak layout:
To Reproduce
d
key on qwerty which iss
on colemak.Please try and add a codesandbox or stackblitz to reproduce the bug:
Expected behavior
Single key press should register single keystroke
Screenshots
Dropover Video
The text was updated successfully, but these errors were encountered: