Contact emailsdizha...@chromium.org

Specificationhttps://w3c.github.io/selection-api/#dom-selection-iscollapsed

Summary

Selection isCollapsed should return true if and only if the anchor and
focus are the same. This should be true whether the selection starts/ends
inside a light or a shadow tree. Currently, the chromium implementation
returns true if selection's anchor node is in a shadow tree, even if the
selection itself is not collapsed. We fix this by removing the erroneous
shadow tree check.


Blink componentBlink>DOM>ShadowDOM
<https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink%3EDOM%3EShadowDOM>

TAG reviewNone

TAG review statusNot applicable

Risks


Interoperability and Compatibility

This matches the standards definition of a collapsed selection. This
matches Firefox/Gecko's implementation. Safari/Webkit still has this bug.
Because Selection in and across shadow trees is not well supported yet,
this bug has been in the code for a long time. We added a use counter to
check how often the result for selection.isCollapsed will differ due to
this shadow tree check (called SelectionIsCollapsedBehaviorChange).
Currently, Selection::isCollapsed is high usage at 3% of all page loads
[1]. On the other hand, the SelectionIsCollapsedBehaviorChange feature
change is currently at a low usage of 0.001% of all page loads [2].
Overall, since the change usage is low and we are making this change to fix
a bug with clear specification text, the compatibility risk is low. [1]
https://chromestatus.com/metrics/feature/timeline/popularity/1001 [2]
https://chromestatus.com/metrics/feature/timeline/popularity/5101


*Gecko*: Shipped/Shipping

*WebKit*: No signal Webkit has this bug, since this has existed for a long
time.

*Web developers*: No signals

*Other signals*:

Ergonomics

There are no other APIs that this feature will used in tandem with.


Activation

It should not be challenging for developers to take advantage of this
feature immediately.


Security

There are no security risks for this feature.


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

DevTools support for this feature is not needed.


Will this feature be supported on all six Blink platforms (Windows, Mac,
Linux, ChromeOS, Android, and Android WebView)?Yes

All platforms support DOM selection.


Is this feature fully tested by web-platform-tests
<https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md>
?Yes

https://wpt.fyi/results/selection/shadow-dom/tentative/Selection-isCollapsed.html?label=experimental&label=master&aligned


Flag name on chrome://flagsSelectionIsCollapsedShadowDOMSupport

Finch feature nameNone

Non-finch justification

This is a long term bug fix and is a no developer-visible change.


Requires code in //chrome?False

Tracking bughttps://issues.chromium.org/issues/40400558

Sample links
https://codepen.io/Di-Zhang/pen/jOjdeoX

Estimated milestones
Shipping on desktop 131
Shipping on Android 131
Shipping on WebView 131

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/5175599392620544?gate=5084420995022848

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/CA%2BSS7eCxjhuVojPQe%2BFekbsR%2B8ttnGa2_9FbGM-t3uJPmS51Og%40mail.gmail.com.

Reply via email to