W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2010

ISSUE-140 (textInput keydown keypress): textInput event as default action of both keydown and keypress? [DOM3 Events]

From: Web Applications Working Group Issue Tracker <sysbot+tracker@w3.org>
Date: Wed, 06 Oct 2010 06:21:36 +0000
To: public-webapps@w3.org
Message-Id: <E1P3NNg-0004k8-3F@lowblow.w3.org>

ISSUE-140 (textInput keydown keypress): textInput event as default action of both keydown and keypress? [DOM3 Events]

http://www.w3.org/2008/webapps/track/issues/140

Raised by: Doug Schepers
On product: DOM3 Events

Hallvord R. M. Steen <http://lists.w3.org/Archives/Public/www-dom/2010JulSep/0179.html>:
[[
spec currently says about 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

and about the keypress event (in the table):

> Default action	Varies: textInput event;

So an implementation that follows this spec to the T might end up firing  
textInput twice for all input, once as the default action of keydown and  
once as the default action of keypress..

What implementations actually do (and current web content requires) is to  
fire *keypress* as the default action of the keydown event. Then the  
keypress event's default action is to fire textInput.

I suggest fixing the spec to say keydown's default action is a keypress  
event.

(Firefox has a small quirk that the spec IMO can ignore in that  
preventDefault() on keydown doesn't actually prevend the keypress event  
 from firing - but it fires "pre-cancelled". At some point in time, some  
legacy content required this behaviour - but other browsers align on  
making keypress entirely preventable.)]]
Received on Wednesday, 6 October 2010 06:21:37 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:41 GMT