Bug 81661

Summary: keypress event fired at <body> ends up adding text to a text field
Product: WebKit Reporter: jochen
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: ap, ojan, rniwa
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
layout test none

jochen
Reported 2012-03-20 07:01:37 PDT
Created attachment 132820 [details] layout test The attached layout tests demonstrates that a keypress event fired at body (or some other non-editable node for that matter) can end up editing another part of the node, if one of the event handlers changes the selection. I've tested this with Chrome, and Safari, both will insert "a" into the text field. Firefox does not, IE9 does enter it. It's not clear to me, what the expected behavior is? See also bug 81660
Attachments
layout test (752 bytes, patch)
2012-03-20 07:01 PDT, jochen
no flags
Alexey Proskuryakov
Comment 1 2012-03-20 09:52:31 PDT
WebKit/IE behavior makes good sense to me.
jochen
Comment 2 2012-03-20 12:21:49 PDT
(In reply to comment #1) > WebKit/IE behavior makes good sense to me. what strikes me as strange is that the event target is the body element, while the text is inserted in the input field.
Ryosuke Niwa
Comment 3 2012-03-20 12:25:31 PDT
(In reply to comment #2) > (In reply to comment #1) > > WebKit/IE behavior makes good sense to me. > > what strikes me as strange is that the event target is the body element, while the text is inserted in the input field. But the focus is at the input element, right? The event target can't be changed once the event is dispatched, but the focus element can be changed after the fact.
jochen
Comment 4 2012-03-20 12:29:03 PDT
(In reply to comment #3) > (In reply to comment #2) > > (In reply to comment #1) > > > WebKit/IE behavior makes good sense to me. > > > > what strikes me as strange is that the event target is the body element, while the text is inserted in the input field. > > But the focus is at the input element, right? The event target can't be changed once the event is dispatched, but the focus element can be changed after the fact. yes
jochen
Comment 5 2012-03-30 01:27:29 PDT
Closing as invalid as this seems to be working as intended
Note You need to log in before you can comment on or make changes to this bug.