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.
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
There are no other APIs that this feature will used in tandem with.
It should not be challenging for developers to take advantage of this feature immediately.
There are no security risks for this feature.
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
None
DevTools support for this feature is not needed.
All platforms support DOM selection.
This is a long term bug fix and is a no developer-visible change.
Shipping on desktop | 131 |
Shipping on Android | 131 |
Shipping on WebView | 131 |
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).
NoneTo unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.