-
Notifications
You must be signed in to change notification settings - Fork 4
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: (Macos) pressing cmd+c or any shortcut that has cmd in it will break any registered shortcuts unless the window goes blur #576
Comments
Thanks for filing an issue. Taking a quick look at the sample app attached, there's an issue that could possibly be related.
const handleShortcut = useCallback(() => {
setShow(prev => !prev);
}, []);
useEffect(() => {
registerShortcut(handleShortcut, ['k'], 'show', 'show')
return () => {
unregisterShortcut(['k'])
}
}, [handleShortcut]); Past that, the test suite of this library should encompass any edge-cases and they currently pass. If there's an issue with unsetting shortcuts, you're welcome to submit a PR with a failing test case and fix. |
I don't mean to The problem might be related to this https://stackoverflow.com/questions/27380018/when-cmd-key-is-kept-pressed-keyup-is-not-triggered-for-any-other-key To demonstrate this when I am pressing & holding the Looking at the code it seems that you are not clearing the keyDowns array since there is no keyup for
This can't be replicated through a testing library because you are firing the events yourself. While irl behaviour is out of the ordinary. |
It's certainly not bragging to be wrong about how to use hooks properly. Regardless, as stated in the original reply, you're welcome to submit a PR with a new test case and fix to address the problem. |
Hi ! @tlackemann . I opened a little PR for this issue. Thanks. |
Bump. I am experiencing this as well. |
Also experiencing this! |
Suppose we have a sample app like below. Assume
<App />
is wrapped with<ShortcutProvider>
Sample application. Please click me!
If I press the cmd key or press cmd+c, the registered shortcut 'k' stops working. This is not the case in Windows though.
The text was updated successfully, but these errors were encountered: