Yes, the API returns offset inside text input and textarea elements. Thanks, Siye
On Wednesday, June 5, 2024 at 5:10:18 PM UTC-7 Brian Birtles wrote: > Hi, > > Does this return the offset inside text input elements like Gecko's > implementation? > > Best regards, > > Brian > > 2024年6月6日木曜日 3:20:24 UTC+9 si...@microsoft.com: > >> Contact emails >> si...@microsoft.com, sa...@microsoft.com >> >> Explainer >> None >> >> Specification >> https://drafts.csswg.org/cssom-view/#dom-document-caretpositionfrompoint >> >> Summary >> This new API allows users to get current caret position from a given >> screen point. >> >> The API returns a CaretPosition object which represents the caret >> position indicating current text insertion point including the containing >> DOM node, caret's character offset, and the client rectangle of caret >> range. The API also supports get CaretPosition inside Shadow DOM. To get >> CaretPosition inside Shadow DOM, caller needs to provide reference to all >> the shadow roots that this API can pierce into. >> >> >> Blink component >> Blink>CSS >> <https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink%3ECSS> >> >> TAG review >> document.caretPositionFromPoint API in shadow DOM scenario · Issue #949 · >> w3ctag/design-reviews (github.com) >> <https://github.com/w3ctag/design-reviews/issues/949> >> >> TAG review status >> Issues open >> >> Risks >> >> >> Interoperability and Compatibility >> Gecko already implemented the API without the argument that contains >> shadow roots that this API can pierce into. Webkit/Blink didn't implement >> it. The Gecko implementation in shadow DOM scenario is not spec-compliant >> either (Spec changed recently to cover shadow DOM scenario). Gecko 's >> position is positive on this API. We expect that Gecko's behavior will be >> changed to be spec-compliant in the future. There is also a future compat >> risk too if we decided to deprecate the non-standard API >> `document.caretRangeFromPoint`: https://crbug.com/690599 >> >> >> *Gecko*: Positive ( >> https://github.com/mozilla/standards-positions/issues/1012) >> >> *WebKit*: Support ( >> https://github.com/WebKit/standards-positions/issues/301) >> >> *Web developers*: Positive ( >> https://bugs.chromium.org/p/chromium/issues/detail?id=388976#c34) Web >> developers are asking to have document.caretPositionFromPoint API >> implemented in Blink: >> https://bugs.chromium.org/p/chromium/issues/detail?id=388976#c28 >> https://bugs.chromium.org/p/chromium/issues/detail?id=388976#c34 >> >> *Other signals*: >> >> WebView application risks >> *Does this intent deprecate or change behavior of existing APIs, such >> that it has potentially high risk for Android WebView-based applications?* >> None >> >> >> Debuggability >> None >> >> >> Will this feature be supported on all six Blink platforms (Windows, Mac, >> Linux, ChromeOS, Android, and Android WebView)? >> Yes >> >> Is this feature fully tested by web-platform-tests >> <https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md> >> ? >> Yes >> >> >> 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 >> >> >> Flag name on chrome://flags >> None >> >> Finch feature name >> CaretPositionFromPoint >> >> Requires code in //chrome? >> False >> >> Tracking bug >> https://crbug.com/388976 >> >> Estimated milestones >> Shipping on desktop >> 127 >> DevTrial on desktop >> 127 >> >> >> Anticipated spec changes >> *Open questions about a feature may be a source of future web compat or >> interop issues. Please list open issues (e.g. links to known github issues >> in the project for the feature specification) whose resolution may >> introduce web compat/interop risk (e.g., changing to naming or structure of >> the API in a non-backward-compatible way).* >> None >> >> Link to entry on the Chrome Platform Status >> https://chromestatus.com/feature/5201014343073792 >> >> Links to previous Intent discussions >> Intent to prototype: >> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/2618db7c-56d2-4ff2-89c5-df65e1dfe6c7n%40chromium.org >> Ready >> for Trial: >> https://groups.google.com/a/chromium.org/g/blink-dev/c/v4MLESmFR1c/m/UhstKjucAAAJ >> >> >> This intent message was generated by Chrome Platform Status >> <https://chromestatus.com/>. >> > -- You received this message because you are subscribed to the Google Groups "blink-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscr...@chromium.org. To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/4127f29a-82e6-41d0-bab4-596f66fa43c9n%40chromium.org.