- From: L. David Baron <dbaron@dbaron.org>
- Date: Wed, 22 Jun 2011 12:08:32 -0700
- To: Olli@pettay.fi
- Cc: Ojan Vafai <ojan@chromium.org>, www-dom@w3.org
On Wednesday 2011-06-22 21:56 +0300, Olli Pettay wrote: > On 06/22/2011 09:33 PM, Ojan Vafai wrote: > >While I agree that having keydown/keyup be symmetric would be a better > >API, every browser currently implements it repeating keydown events. > > Yeah, the current implementations are the reason why repeating > keydown/up has been spec'ed the way they are. Really? I thought the last time I raised this issue I was told it was specced this way because the mechanism was needed to detect repetition of keys that don't lead to text. But that was during the period when the "keypress" event wasn't in the spec at all. The threads I could find discussing this are: http://lists.w3.org/Archives/Public/www-dom/2005JanMar/thread.html#msg2 http://lists.w3.org/Archives/Public/public-webapi/2007Aug/0008.html but I think there was a more recent one where I debated it with Doug Schepers. -David > >On Wed, Jun 22, 2011 at 11:25 AM, L. David Baron <dbaron@dbaron.org > ><mailto:dbaron@dbaron.org>> wrote: > > > > http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents says: > > # Holding down a key must result in the repeating the events > > # keydown, keypress (when supported by the user agent), and > > # textinput (when the keypress results in text input) in this > > # order, at a rate determined by the system configuration. > > > > I think this is a bad idea because it introduces asymmetry between > > the keydown and keyup events (which I think authors would reasonably > > expect to be symmetric) and because it defines keydown in a way that > > also violates a reasonable expectation -- that it be fired when the > > key is pressed (just like the existing "mousedown" event). > > > > Instead, I propose that key repetition be handled by repetitions of > > the keypress and textinput events, but that the keydown event not > > repeat. > > > > Changing this would also require that the keypress event fire for > > keys that do not produce a character value (e.g., arrow keys, > > backspace), which > > http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboard-event-order > > says is not the case, since authors do need to detect repetitions of > > those keys. > > > > -David > > > > -- > > L. David Baron http://dbaron.org/ > > Mozilla Corporation http://www.mozilla.com/ > > > > -- L. David Baron http://dbaron.org/ Mozilla Corporation http://www.mozilla.com/
Received on Wednesday, 22 June 2011 19:09:00 UTC