Closed dizhang168 closed 1 month ago
The use case for this parameter was discussed here: https://github.com/w3ctag/design-reviews/issues/694#issuecomment-1082211834
cc: @mfreed7
Conversation about the selectionRoot
argument is found roughly here:
https://github.com/WICG/webcomponents/issues/79#issuecomment-962013007
Also note that providing selectionRoot
automatically adds the containing shadow root to shadowRoots
so that only the one argument is required in the common use case that a web component wants to just manage selections within its shadow.
@johanneswilm would you mind please Agenda+'ing this issue for TPAC? I don't have permission.
Summary of discussion at TPAC: This addition was suggested when the Selection API was first designed, but there has been no recent web developer feedback. Authors can also write library for this, it's not a new primitive. RESOLVED to wait on this until we have more developer feedback.
Closing this as this proposal is not in consideration for the current version of getComposedRanges. We can re-open if needed.
To simplify selection for components that only wish to handle selections within a sub-tree, we would like to add the optional selectionRoot parameter. If provided, the returned StaticRange from getComposedRanges() will only contain endpoints that are inclusive descendants of this selectionRoot.
Proposal:
We would also need to redefine how the rescoping works for selectionRoot:
Resources
This parameter was first suggested in the explainer and had positive feedback. Please see the example in the explainer as it illustrates this parameter well.
Related issue: https://github.com/w3c/selection-api/issues/176