W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2010

one keydown might fire multiple keypress/textInput events

From: Hallvord R. M. Steen <hallvord@opera.com>
Date: Wed, 22 Sep 2010 14:50:58 +0900
To: "www-dom@w3.org" <www-dom@w3.org>
Message-ID: <op.vje6i80qa3v5gv@hr-opera>
Spec text on keydown event

> if the key is associated with a character, the default action
> shall be to dispatch a textInput event with the character as
> the value of the TextEvent.data attribute

uses singular forms ('a textInput event') which doesn't take into account  
that a single keydown event might cause several keypress (-> textInput)  

Trivial example: press a dead key twice. The default action of the second  
keydown will be to fire two keypress and two text input events.

More far-fetched: use a keyboard layout where some keys are mapped to  
input several characters. Chrome, Firefox and IE (on Windows) agree on  
firing keydown, multiple keypress (and multiple textInput if supported),  
single keyup.

Suggested text:

<li>if the key inserts one or more characters, the default action shall be  
to dispatch one <a class="eventtype"  
href="#event-type-textInput"><code>textInput</code></a> event for each  
character inserted, with that character as the value of the <a  
href="#events-TextEvent-data"><code>TextEvent.data</code></a> attribute

(Leaving aside for a moment the issue that I would also like to replace  
textInput with keypress in that text..)

Hallvord R. M. Steen, Core Tester, Opera Software
http://www.opera.com http://my.opera.com/hallvors/
Received on Wednesday, 22 September 2010 05:51:23 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:16 UTC