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 <[email protected]> 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. > > >
