W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

Re: Where should UA insert text when the focus is changed in a keypress event handler?

From: Ojan Vafai <ojan@chromium.org>
Date: Tue, 20 Mar 2012 11:58:20 -0700
Message-ID: <CANMdWTuuEN90ALh5mXbadKy9AjppGW4n_MBuM+H5+LgyBSMVYQ@mail.gmail.com>
To: Ryosuke Niwa <rniwa@webkit.org>
Cc: public-webapps <public-webapps@w3.org>, Aryeh Gregor <ayg@aryeh.name>
With my web developer hat on, I would expect the WebKit/IE behavior.
Keypress is fired before the DOM is modified (I tested in Gecko and WebKit
on an input element). As such, I'd expect focus changed during a keypress
event to change where the text is inserted. Notably, Gecko does the
WebKit/IE behavior if you use keydown instead of keypress. I don't see any
reason keypress should be different from keydown.

On Tue, Mar 20, 2012 at 10:54 AM, Ryosuke Niwa <rniwa@webkit.org> wrote:

> Hi,
>
> We're trying to figure out inside which element the editing operation must
> be done when a keypress event handler changes the focused element /
> selection for https://bugs.webkit.org/show_bug.cgi?id=81661.
>
> Should it be done at wherever focus is after keypress event is dispatched?
> Or whatever keypress event's target was?
>
> DOM level 3 events doesn't seem to specify this behavior:
>
> http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#event-type-keypress
>
> According to a fellow WebKit contributor, WebKit and Internet Explorer use
> the current focused element whereas Firefox uses the event target.
>
> Best,
> Ryosuke Niwa
> Software Engineer
> Google Inc.
>
>
>
Received on Tuesday, 20 March 2012 18:59:09 GMT

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