web-platform-tests / interop

web-platform-tests Interop project
https://wpt.fyi/interop
311 stars 28 forks source link

document.caretPositionFromPoint() #710

Open BenjaminAster opened 1 month ago

BenjaminAster commented 1 month ago

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

sanketj commented 1 month ago

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

gsnedders commented 1 month ago

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

sanketj commented 1 month ago

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