[whatwg] focus change inside keypress event handler

Maciej Stachowiak mjs at apple.com
Thu Oct 29 19:16:50 PDT 2009


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




More information about the whatwg mailing list