W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2009

[whatwg] focus change inside keypress event handler

From: Maciej Stachowiak <mjs@apple.com>
Date: Thu, 29 Oct 2009 19:16:50 -0700
Message-ID: <F7965E00-2B6F-4AAA-8078-1C9C13E6D4F8@apple.com>

On Oct 29, 2009, at 5:51 PM, Boris Zbarsky wrote:

> On 10/29/09 5:24 PM, Michael A. Puls II wrote:
>> I think so. The event target isn't changed by focus().
>>
>> But, in Firefox, Safari and Opera, it's possible to change what  
>> element
>> the text is inserted into by changing the focus in 'keydown'.
>
> Right; that happens because the keydown and keypress events need not  
> fire on the same element and because the text entry is the keypress  
> default action.  In Gecko, that is.  I can't speak to Safari and  
> Opera.

WebKit also makes typing take effect as the default action for  
"keypress", at least for normal typing. It's more complicated when  
international text input methods are in play.

Regards,
Maciej
Received on Thursday, 29 October 2009 19:16:50 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:18 UTC