<?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>16976</bug_id>
          
          <creation_ts>2008-01-22 11:51:28 -0800</creation_ts>
          <short_desc>caret position needs to be set *before* firing/handling input events</short_desc>
          <delta_ts>2022-07-30 13:18:15 -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>HTML Editing</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tim S">timmmaaayyy</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>aroben</cc>
    
    <cc>bfulgham</cc>
    
    <cc>ddkilzer</cc>
    
    <cc>harrison</cc>
    
    <cc>justin.garcia</cc>
    
    <cc>rniwa</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>67962</commentid>
    <comment_count>0</comment_count>
    <who name="Tim S">timmmaaayyy</who>
    <bug_when>2008-01-22 11:51:28 -0800</bug_when>
    <thetext>Editor::appliedEditing currently dispatches input events and after sets the selection (caret) to the end of the text. This means when handling an input event, you cannot modify the selection without being &apos;trumped&apos; by this later setting by appliedEditing. 

I tried making a patch to fix this by simply moving one line in this method, dispatchEditibleContentChangedEvents, 5 lines down so it occurs after the call to setSelection. I created a layout test to verify (see attached). However, the patch causes two layout tests to fail: fast/forms/drag-into-textarea.html and fast/forms/drag-out-of-textarea.html. The output differs in these two tests because rather than cut/pasting, the drag an drop results in both fields being empty or both fields containing the text, respectively. The expected output is correct and I don&apos;t think it should be changed, so this attempt to fix breaks text drag and drop, but I&apos;m not sure why.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67963</commentid>
    <comment_count>1</comment_count>
      <attachid>18602</attachid>
    <who name="Tim S">timmmaaayyy</who>
    <bug_when>2008-01-22 11:55:45 -0800</bug_when>
    <thetext>Created attachment 18602
test that caret selection is set before firing input event

currently fails on recent c.o @ r29678</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67966</commentid>
    <comment_count>2</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-01-22 12:30:23 -0800</bug_when>
    <thetext>The test passes in FF and Opera, and does not actually execute cleanly in IE.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72058</commentid>
    <comment_count>3</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2008-02-26 15:05:23 -0800</bug_when>
    <thetext>&lt;rdar://problem/5766949&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1887865</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-07-30 09:45:00 -0700</bug_when>
    <thetext>I am unable to reproduce this bug in Safari 15.6 on macOS 12.5 using attached test case and as soon as I type something in &lt;input&gt; field, I get &quot;test passed&quot; and it is same across all other browsers (Firefox Nightly 105 and Chrome Canary 106). I think it got fixed along the way and this can be marked as &quot;RESOLVED CONFIGURATION CHANGED&quot;. Thanks!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>18602</attachid>
            <date>2008-01-22 11:55:45 -0800</date>
            <delta_ts>2008-01-22 11:55:45 -0800</delta_ts>
            <desc>test that caret selection is set before firing input event</desc>
            <filename>set-selection-before-input-event.html</filename>
            <type>text/html</type>
            <size>1128</size>
            <attacher name="Tim S">timmmaaayyy</attacher>
            
              <data encoding="base64">PGh0bWw+DQoJPGhlYWQ+DQoJCTxzY3JpcHQ+DQoJCQlmdW5jdGlvbiB0ZXN0KCkgew0KCQkJICBk
b2N1bWVudC5nZXRFbGVtZW50QnlJZCgidGFyZ2V0IikuYWRkRXZlbnRMaXN0ZW5lcigiaW5wdXQi
LCBpbnB1dEhhbmRsZXIsIGZhbHNlKTsNCg0KCQkgICAgICAgIH0NCiAgICAgICAgICAgICAgICAg
ICAgICAgIHZhciBmaW5pc2hlZCA9IGZhbHNlOw0KCQkJZnVuY3Rpb24gZmluaXNoKCkgew0KCQkg
ICAgICAgICAgaWYgKGZpbmlzaGVkKQ0KICAJCQkgICAgcmV0dXJuOw0KICAgICAgICAgICAgICAg
ICAgICAgICAgICBmaW5pc2hlZCA9IHRydWU7DQoJCQkgIGlmIChzZWxlY3Rpb25TdGFydCA9PSAx
KQ0KCQkJICAgIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJyZXN1bHQiKS5pbm5lckhUTUwgPSBk
b2N1bWVudC5nZXRFbGVtZW50QnlJZCgicmVzdWx0IikuaW5uZXJIVE1MICsgInRlc3QgcGFzc2Vk
IjsNCgkJCSAgZWxzZQ0KCQkJICAgIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJyZXN1bHQiKS5p
bm5lckhUTUwgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgicmVzdWx0IikuaW5uZXJIVE1MICsg
InRlc3QgZmFpbGVkIjsNCgkJCX0NCgkJCXZhciBzZWxlY3Rpb25TdGFydCA9IDA7DQoJCQlmdW5j
dGlvbiBpbnB1dEhhbmRsZXIoKSB7DQogIAkJCSAgc2VsZWN0aW9uU3RhcnQgPSBkb2N1bWVudC5n
ZXRFbGVtZW50QnlJZCgidGFyZ2V0Iikuc2VsZWN0aW9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