<?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>287472</bug_id>
          
          <creation_ts>2025-02-11 00:21:36 -0800</creation_ts>
          <short_desc>document.caretPositionFromPoint returns null over SVG elements and elements with `-webkit-user-select: none`</short_desc>
          <delta_ts>2025-08-21 13:39:11 -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>DOM</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://github.com/web-platform-tests/wpt/pull/54176</see_also>
          <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>
          
          <blocked>286941</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Anne van Kesteren">annevk</reporter>
          <assigned_to name="Aditya Keerthi">akeerthi</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>rbuis</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2093752</commentid>
    <comment_count>0</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2025-02-11 00:21:36 -0800</bug_when>
    <thetext>&lt;svg width=100 height=100&gt;&lt;circle cx=50 cy=50 r=50 /&gt;&lt;/svg&gt;
&lt;script&gt;
range = document.caretRangeFromPoint(50, 50);
w(range);
&lt;/script&gt;

logs null instead of a range pointing to the svg element. This can make shadow trees containing SVG observable (as we return null rather than a range for the host element). I discovered this in bug 286803.

https://software.hixie.ch/utilities/js/live-dom-viewer/?%3Csvg%20width%3D100%20height%3D100%3E%3Ccircle%20cx%3D50%20cy%3D50%20r%3D50%20%2F%3E%3C%2Fsvg%3E%0A%3Cscript%3E%0Arange%20%3D%20document.caretRangeFromPoint(50%2C%2050)%3B%0Aw(range)%3B%0A%3C%2Fscript%3E</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2095417</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-02-18 00:25:08 -0800</bug_when>
    <thetext>&lt;rdar://problem/145038689&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2107552</commentid>
    <comment_count>2</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2025-03-31 13:46:06 -0700</bug_when>
    <thetext>Shouldn&apos;t this be `document.caretPositionForPoint()`?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2107558</commentid>
    <comment_count>3</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2025-03-31 13:51:47 -0700</bug_when>
    <thetext>https://software.hixie.ch/utilities/js/live-dom-viewer/saved/13608</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2107734</commentid>
    <comment_count>4</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2025-03-31 23:27:06 -0700</bug_when>
    <thetext>I&apos;m pretty sure both use the same underlying infrastructure and we need to fix that as this ends up exposing shadow roots when they use SVG.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2134622</commentid>
    <comment_count>5</comment_count>
    <who name="Aditya Keerthi">akeerthi</who>
    <bug_when>2025-08-05 20:53:17 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/48997</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2134761</commentid>
    <comment_count>6</comment_count>
    <who name="Aditya Keerthi">akeerthi</who>
    <bug_when>2025-08-06 14:29:16 -0700</bug_when>
    <thetext>Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/54176</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2134818</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-08-06 18:08:19 -0700</bug_when>
    <thetext>Committed 298313@main (74c2e1e966aa): &lt;https://commits.webkit.org/298313@main&gt;

Reviewed commits have been landed. Closing PR #48997 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2138077</commentid>
    <comment_count>8</comment_count>
    <who name="Aditya Keerthi">akeerthi</who>
    <bug_when>2025-08-21 13:39:11 -0700</bug_when>
    <thetext>*** Bug 287796 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>