interop
interop copied to clipboard
document.caretPositionFromPoint()
Description
The document.caretPositionFromPoint() method is currently not implemented in WebKit. Instead, WebKit implements the non-standard document.caretRangeFromPoint() method, which returns a Range instead of a CaretPosition. Note that Chromium also only recently added support for the standardized method.
Specification
https://drafts.csswg.org/cssom-view-1/#dom-document-caretpositionfrompoint
Additional Signals
WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=172137
+1 to this proposal
I think this proposal should explicitly include supporting getting caret positions inside shadow DOM using the options parameter (https://drafts.csswg.org/cssom-view-1/#dictdef-caretpositionfrompointoptions). That has been a popular ask from web developers, but Chromium is currently the only engine that implements that part of the spec.
There appear to be basically no tests in WPT for this?
There are some here: https://github.com/web-platform-tests/wpt/blob/master/css/cssom/caretPositionFromPoint.html https://github.com/web-platform-tests/wpt/blob/master/shadow-dom/Document-caretPositionFromPoint.tentative.html
cc: @siliu1
Thank you for proposing document.caretPositionFromPoint() for inclusion in Interop 2025.
We are pleased to let you know that this proposal was accepted as part of the Web Compat focus area. You can follow the progress of this focus area on the Interop 2025 dashboard.
For an overview of our process, see proposal selection. Thank you for contributing to Interop 2025!
Posted on behalf of the Interop team.