News for hackers. Stuff that matters.
Re:Mousetrap: Keyboard shortcuts in Javascript by jabiko on Thursday July 05, 2012 @03:49PM (#4204651)
I think there is no way to change this behavior: https://developer.mozilla.org/en/DOM/KeyboardEvent#Auto-repe...
Re:Mousetrap: Keyboard shortcuts in Javascript by ajross on Thursday July 05, 2012 @04:03PM (#4204712)
It's a mess (the core problem is that the X server automatically generates release/press event pairs to implement key repeat which can't affirmatively be detected as "synthetic"). But it's handlable heuristically.

The way I've seen it done it via a timeout on "release after a long press". If the key has been down for more than ~1 second, then hold off on interpreting a release event to see if there's a matching press already queued in the pipe or not. The timeout can be very short (the X server sends them both synchronously down the socket with no delay).