interop icon indicating copy to clipboard operation
interop copied to clipboard

document.caretPositionFromPoint()

Open BenjaminAster opened this issue 1 year ago • 3 comments

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

BenjaminAster avatar Sep 17 '24 20:09 BenjaminAster

+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.

sanketj avatar Sep 17 '24 21:09 sanketj

There appear to be basically no tests in WPT for this?

gsnedders avatar Sep 17 '24 22:09 gsnedders

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

sanketj avatar Sep 17 '24 22:09 sanketj

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.

wpt-interop avatar Feb 13 '25 17:02 wpt-interop