-
-
Notifications
You must be signed in to change notification settings - Fork 412
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
binding detection does not work #426
Comments
I have a similar issue:
this breaks in v3.10.3, works as expected in v3.10.2 |
@magicdawn You can reproduce your error. https://codepen.io/jaywcjlove/pen/xxQdNQp?editors=0010 Line 282 in 8b8d7d9
Line 303 in 8b8d7d9
|
Key sequence
v3.10.2 works as expected, v3.10.3 |
@magicdawn Upgrade |
@jaywcjlove It seems that the fix does not work for the above mentioned example, upgraded to v3.10.4: |
@artola https://codepen.io/jaywcjlove/pen/NWEgNqo?editors=1010 import hotkeysJs from "https://cdn.skypack.dev/[email protected]";
window.addEventListener("DOMContentLoaded", (event) => {
const button = document.querySelector('button');
button.focus();
hotkeys('command+r,command+r+0', undefined, (keyboardEvent, hotkeysEvent) => {
keyboardEvent.preventDefault();
keyboardEvent.stopPropagation();
button.innerHTML = "prevented";
return false;
});
}); |
Thanks @jaywcjlove. But look in my original issue, my expectation is:
If that is fulfilled, then the code should trap the keystrokes and avoid a page reload without changing the listeners, but it does not:
|
I have a similar problem:
I think may be you have fixed problem about [cmd+] but not [cmd+shift+]. |
Multiple keystrokes without release are not properly detected and therefore the shortcut is not fired.
See for example the following Codepen. Here I just try to trap and handle "Cmd+R", when it is not properly detected it is caught Chrome and produces a page reload.
The sequence is:
Use this debug page: https://cdpn.io/pen/debug/gOBvOXr?authentication_hash=ZoABapBwEZGr
The source of this repro: https://codepen.io/artola-the-decoder/pen/gOBvOXr
The expected behaviour is that after a non control key (I mean when a letter, number or symbol) is pressed, the logic should restart.
This sequence executed above:
CMD + 0 + R
, should be treated asCMD + 0
andCMD + R
.Here the same example refactored with
mousetrap
and it works as expected: https://codepen.io/artola-the-decoder/pen/zYmRxVBThe text was updated successfully, but these errors were encountered: