Hotkey held status not cleared if you open a new tab or focus is lost for example.
LiamKarlMitchell opened this issue · comments
window.open(card.url, '_blank', 'noopener')
Could possibly use visibility change event listener to clear any held keys when window/tab looses focus?
document.addEventListener("visibilitychange", onchange)
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.
window.open(card.url, '_blank', 'noopener')
Could possibly use visibility change event listener to clear any held keys when window/tab looses focus?
document.addEventListener("visibilitychange", onchange)
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.
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.
- So when the document gets focus again I think it needs to clear the keys that are pressed.
- And possibly when the handler is triggered for a known key sequence, it should clear pressed keys maybe.
Any time the focus is lost the keyup event isn't sent to the browser of course.
- So when the document gets focus again I think it needs to clear the keys that are pressed.
- And possibly when the handler is triggered for a known key sequence, it should clear pressed keys maybe.
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