<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>81661</bug_id>
          
          <creation_ts>2012-03-20 07:01:37 -0700</creation_ts>
          <short_desc>keypress event fired at &lt;body&gt; ends up adding text to a text field</short_desc>
          <delta_ts>2012-03-30 01:27:29 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>UI Events</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>jochen</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>ojan</cc>
    
    <cc>rniwa</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>583030</commentid>
    <comment_count>0</comment_count>
      <attachid>132820</attachid>
    <who name="">jochen</who>
    <bug_when>2012-03-20 07:01:37 -0700</bug_when>
    <thetext>Created attachment 132820
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&apos;ve tested this with Chrome, and Safari, both will insert &quot;a&quot; into the text field. Firefox does not, IE9 does enter it.

It&apos;s not clear to me, what the expected behavior is?

See also bug 81660</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>583158</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-03-20 09:52:31 -0700</bug_when>
    <thetext>WebKit/IE behavior makes good sense to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>583346</commentid>
    <comment_count>2</comment_count>
    <who name="">jochen</who>
    <bug_when>2012-03-20 12:21:49 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>583350</commentid>
    <comment_count>3</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2012-03-20 12:25:31 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; (In reply to comment #1)
&gt; &gt; WebKit/IE behavior makes good sense to me.
&gt; 
&gt; 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&apos;t be changed once the event is dispatched, but the focus element can be changed after the fact.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>583352</commentid>
    <comment_count>4</comment_count>
    <who name="">jochen</who>
    <bug_when>2012-03-20 12:29:03 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; (In reply to comment #1)
&gt; &gt; &gt; WebKit/IE behavior makes good sense to me.
&gt; &gt; 
&gt; &gt; what strikes me as strange is that the event target is the body element, while the text is inserted in the input field.
&gt; 
&gt; But the focus is at the input element, right? The event target can&apos;t be changed once the event is dispatched, but the focus element can be changed after the fact.

yes</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>591947</commentid>
    <comment_count>5</comment_count>
    <who name="">jochen</who>
    <bug_when>2012-03-30 01:27:29 -0700</bug_when>
    <thetext>Closing as invalid as this seems to be working as intended</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>132820</attachid>
            <date>2012-03-20 07:01:37 -0700</date>
            <delta_ts>2012-03-20 07:01:37 -0700</delta_ts>
            <desc>layout test</desc>
            <filename>patch</filename>
            <type>text/plain</type>
            <size>752</size>
            <attacher>jochen</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL0xheW91dFRlc3RzL2Zhc3QvZm9ybXMvdGV4dGZpZWxkLWZvY3VzLWNoYXIu
aHRtbCBiL0xheW91dFRlc3RzL2Zhc3QvZm9ybXMvdGV4dGZpZWxkLWZvY3VzLWNoYXIuaHRtbApu
ZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5jOWQwMjdjCi0tLSAvZGV2L251bGwK
KysrIGIvTGF5b3V0VGVzdHMvZmFzdC9mb3Jtcy90ZXh0ZmllbGQtZm9jdXMtY2hhci5odG1sCkBA
IC0wLDAgKzEsMjAgQEAKKzxodG1sPgorPGhlYWQ+Cis8c2NyaXB0Pgorb25rZXlwcmVzcyA9IGZ1
bmN0aW9uIChlKSB7CisgICAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoInRmIikuZm9jdXMoKTsK
K30KKworb25sb2FkID0gZnVuY3Rpb24oKSB7CisgICAgaWYgKHdpbmRvdy5sYXlvdXRUZXN0Q29u
dHJvbGxlcikKKyAgICAgICAgZXZlbnRTZW5kZXIua2V5RG93bigiYSIpOworfQorPC9zY3JpcHQ+
Cis8L2hlYWQ+Cis8Ym9keT4KK1Rlc3QgdGhhdCBmaXJpbmcgYSBcbiBjaGFyIGV2ZW50IGF0IGEg
dGV4dCBmaWVsZCBkb2Vzbid0IGluc2VydCBjaGFyYWN0ZXJzLiBUbworcnVuIHRoZSB0ZXN0IG1h
bnVhbGx5LCBlbnN1cmUgdGhhdCB0aGUgaW5wdXQgZmllbGQgYmVsb3cgaXMgbm90IGZvY3VzZWQs
IGFuZAoraGl0ICJhIi4gVGhlIHRlc3QgcGFzc2VzLCBpZiB0aGUgaW5wdXQgZmllbGQgcmVtYWlu
cyBlbXB0eS48YnI+Cis8aW5wdXQgaWQ9InRmIiB0eXBlPSJ0ZXh0Ij48L2lucHV0PgorPC9ib2R5
PgorPC9odG1sPgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>