waldobronchart/ShortcutMapper

Modifier keys keyUp not recognized on Safari 5.1.10

pps opened this issue · 6 comments

pps commented

Pressing down a modifier key like shift/ctrl/alt or cmd on the physical keyboard updates the display correctly, but when you release that key again, the display is not updated at all. Pressing the key again does nothing as well. In short, the modifier keys get "stuck". Thank you!

pps commented

Never mind. Strangely enough, it now suddenly works correctly.

Its an intermittent issue that I'm seeing too, but I don't know how to fix it yet. Thanks for submitting

FWIW my experience is that it works perfectly on loading the page, but after changing keyboard layout the keyUp is always ignored. This is reproducible on Chrome 35 on Mac OS 10.8. Does that help to pin it down?

I have noticed this too. It's really weird though, I checked to see if the keyUp event gets fired and it does! It's just that the DOM doesn't seem to want to update at that point. The DOM updates through code, but the browser doesn't redraw.

It is because in the _destroy() function, you are trying to unregister the keydown/keyup events with the handler functions. However, you registered them with a proxy wrapper, so it is unable to match those event handlers. The end result is that you have multiple keyup/keydown handlers when you switch applications.

Either store the proxied functions in the local object and use those in the off() calls, or don't bother specifying the handler in off() to turn all handlers off.

Fixed by ehuss