<?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>225723</bug_id>
          
          <creation_ts>2021-05-12 16:38:09 -0700</creation_ts>
          <short_desc>Restoring selection ranges causes text input to ignore keypresses</short_desc>
          <delta_ts>2023-02-26 11:22:31 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>Safari 14</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></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="Nolan Lawson">nlawson</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1759458</commentid>
    <comment_count>0</comment_count>
      <attachid>428433</attachid>
    <who name="Nolan Lawson">nlawson</who>
    <bug_when>2021-05-12 16:38:09 -0700</bug_when>
    <thetext>Created attachment 428433
Minimal repro

Steps to reproduce:

1. Go to https://bl.ocks.org/nolanlawson/raw/c7d8ed3d43dbb4a018fb392467fae365/
2. Click the text input with a mouse
3. Try to type letters on the keyboard

Expected:

The input receives the keypresses and show them.

Actual:

The input remains focused, but it isn&apos;t able to receive keypresses, and the cursor no longer blinks.

Details:

This issue is reproducible in Safari and Chrome, but not Firefox.

It&apos;s also reproducible in Safari Technology Preview 124 (Safari 14.2, WebKit 15612.1.11.10).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1759459</commentid>
    <comment_count>1</comment_count>
    <who name="Nolan Lawson">nlawson</who>
    <bug_when>2021-05-12 16:39:04 -0700</bug_when>
    <thetext>For the record, I filed the same bug on Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=1208631</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1759927</commentid>
    <comment_count>2</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2021-05-13 17:33:21 -0700</bug_when>
    <thetext>This is sort of expected since in WebKit, all typing goes to where the selection is, and Range in this case isn&apos;t representing any position inside the input element. We should probably be clearing the focus in this case, however.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1760110</commentid>
    <comment_count>3</comment_count>
    <who name="Nolan Lawson">nlawson</who>
    <bug_when>2021-05-14 09:37:20 -0700</bug_when>
    <thetext>Thanks for the feedback. Since this didn&apos;t repro in Firefox (or IE11 incidentally), I assumed it was a WebKit/Blink bug.

My assumption as a web developer is that clearing a Selection of its Ranges and then adding those same Ranges back would be a non-destructive action.

If that&apos;s not the case, then is there a way to formulate this as a bug to file on Firefox? Something like &quot;When `selection.removeAllRanges()` is called, focus should be cleared&quot;? It&apos;s not clear to me from the spec how to phrase this: https://w3c.github.io/selection-api/#dom-selection-removeallranges</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1761769</commentid>
    <comment_count>4</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-05-19 16:39:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/78231107&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1890325</commentid>
    <comment_count>5</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-08-10 10:19:11 -0700</bug_when>
    <thetext>I am able to reproduce this bug in Safari 15.6 / TP 150 on macOS 12.5 and I am unable to type in input field. It is same with Chrome Canary 106 while Firefox Nightly 105 allows to type in the field.

Just wanted to update status. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1936867</commentid>
    <comment_count>6</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-02-26 11:22:31 -0800</bug_when>
    <thetext>I am able to reproduce this bug in WebKit ToT (260854@main) with Live Range Selection API enabled as well. Just wanted to confirm that it still exist.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>428433</attachid>
            <date>2021-05-12 16:38:09 -0700</date>
            <delta_ts>2021-05-12 16:38:09 -0700</delta_ts>
            <desc>Minimal repro</desc>
            <filename>index.html</filename>
            <type>text/html</type>
            <size>591</size>
            <attacher name="Nolan Lawson">nlawson</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KPGhlYWQ+CiAgPG1ldGEgY2hhcnNldD0i
VVRGLTgiPgogIDx0aXRsZT5SYW5nZXMgaXNzdWUgcmVwcm88L3RpdGxlPgo8L2hlYWQ+Cjxib2R5
Pgo8aDE+UmFuZ2VzIGlzc3VlIHJlcHJvPC9oMT4KPGxhYmVsPgogIENsaWNrIGFuZCB0aGVuIHR5
cGUgaGVyZToKICA8aW5wdXQgdHlwZT0idGV4dCI+CjwvbGFiZWw+CjxzY3JpcHQ+CiAgZG9jdW1l
bnQucXVlcnlTZWxlY3RvcignaW5wdXQnKS5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIGZ1bmN0
aW9uICgpIHsKICAgIHZhciBzZWxlY3Rpb24gPSBnZXRTZWxlY3Rpb24oKQogICAgdmFyIHJhbmdl
cyA9IFtdCiAgICBmb3IgKHZhciBpID0gMDsgaSA8IHNlbGVjdGlvbi5yYW5nZUNvdW50OyBpKysp
IHsKICAgICAgcmFuZ2VzLnB1c2goc2VsZWN0aW9uLmdldFJhbmdlQXQoaSkpCiAgICB9CiAgICBz
ZWxlY3Rpb24ucmVtb3ZlQWxsUmFuZ2VzKCkKICAgIHJhbmdlcy5mb3JFYWNoKGZ1bmN0aW9uIChy
YW5nZSkgewogICAgICBzZWxlY3Rpb24uYWRkUmFuZ2UocmFuZ2UpCiAgICB9KQogIH0pCjwvc2Ny
aXB0Pgo8L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>