keymaster
keymaster copied to clipboard
Key events not captured when page content loses focus then regains it
If I click the location bar, then the webpage again, key events seem to not be captured. The same goes for if I use a keyboard shortcut to launch Developer Tools and turn it off again. The key events get captured again if I switch to a different tab and back, or if I reload the page. Can anyone reproduce this?
I'm on a Mac, using Chrome 13.0.782.218
I can reproduce launching Developer tools, though do not have location bar issue. I have also notice the issue after a certain amount of time having a tab open in background. I'd say these a chrome bugs, not sure what a fix would be though.
Using Chrome 14.0.835.126 beta on OSX v10.7.1
It's kind of hard to debug this given that it has to do with opening and closing the debugger. I can deal with having the debugger problem there, but the location bar bug is a little irksome.
I tried again with 14.0.835.126 beta, same problem with both the location bar and Developer tools. OSX 10.6.8.
Chromium 13.0.782.215 on Linux
I think I identify the cause of Developer Tools. If you press Ctrl+Shift+I/J to bring up developer tools.
The states of Shift and Control keys in _mod will be stuck as true because keymaster does not receive a keyup event.
If you press Shift and Control after you make page regain focus, the states will be corrected. And it will work again.
I try to "switch tab" but it doesn't work also location bar does not affect. I wonder if that's result of mixed testing.
Reload does work since the code restart.
@jshou this has just come to me, about the location bar, by any chance you were actually pressing Alt+D (not click on it), then click back on the page? It would cause the same issue.
@livibetter, you are exactly right, I hadn't made that connection. I tried hitting Command again and it cleared the state. I'll try the fix, thanks!
@livibetter, I tried pulling the tree from that commit and using keymaster.js, but then none of my ctrl+shift shortcuts worked, I haven't tested this further to see what's causing it though.
I just tried to add ctrl+shift+z and it still works.
were you trying to use keymaster.js from my fork in the page you are currently working on? My fork has become quite a different fork from original code. I don't think you can simply apply.
(PS. you can message me if you need more help with my fork, but I think fix might come up soon)
I am seeing similar issues simply by switching to a different application and then switching back using command+tab on a mac. This happens even on Firefox. Seems like the issue is that the Command modifier remains set when you switch back ... pushing it down once brings back everything to normal ... I will see if I can use the above fix
I am also having this issue on a mac, in Chrome / Safari / FF. Sometimes after switching with ⌘+Tab to other application and back, the ⌘ modifier remains set.
Same issue here on Chrome with OS+X and pressing Cmd+L to go to the location bar.
Hey all, i tried a few scenarios already, but lemme know if this fix doesn't solve your problem.
Hey Lowe, tried your fix, seems to work OK. Thanks!
@lowe, it didn't help in my case. When I switch to other window and back by QUICKLY hitting ⌘+tab, the command modifier being reset as expected. But if I hold down Command key before switching to the other window for a little longer (for about a second), then after I switch back Command modifier remains set.
I checked that resetModifiers() being called in both cases.