-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Hotkey held status not cleared if you open a new tab or focus is lost for example. #9
Comments
oh,I will check it, if there is such a problem, I will take your advice, thank you |
do you want to say document.hasFocus()? |
Any time the focus is lost the keyup event isn't sent to the browser of course.
|
I think it's possible |
Yeah I think the main issue with my thoughts above is preventing it firing constantly when you are holding the keys which is why keyup is used to clear their states? Which could possibly be worked around with a busy flag can't recall if I saw one in the code. if (hotkeyInUse) {
return
}
// When hotkey handler is triggered
hotkeyInUse = true
// When focus is returned
hotkeyInUse = false
// When all the keys are up
hotkeyInUse = false But this could prevent people doing combination hot keys in a sequence around the modifier keys. Like Ctrl + A, Ctrl + B as two separate hotkeys but the user does not let go of Ctrl. |
Yeah, I didn't think of that,would you have time to pr? thank you |
Could possibly use visibility change event listener to clear any held keys when window/tab looses focus?
Or maybe it should clear when handler is executed?
Similar when using a Screen Shot tool like Lightshot, which steals the focus away, the key up event is not received.
The text was updated successfully, but these errors were encountered: