-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modification of selection APIs to account for shadow dom #694
Comments
Took a look at this today with @LeaVerou and @maxpassion, we were wondering what the purpose was of adding |
Thanks for the review and the question. (And sorry for the delay replying!) So I think the main reason for the new function, vs. re-using the old Overall, I think the motivation for a new API was that we're rather-significantly changing the selection API, and beyond the calling syntax, developers will have to understand more about shadow DOM and how this new API works. Giving it a fresh/different function name helps (in my opinion) them understand that there's a difference. I'm open to suggestions, of course. |
Hi @mfreed7, We revisited this today during our Hybrid F2F. We understand the reasoning for defining a new function rather than overloading One thing we noticed is that with the addition of this new function, we will now basically have two independent concepts: While these are orthogonal, authors cannot specify any of the 4 combinations independently, but only two ([a. no, b. live] or [a. yes, b. static]), which is a coupling that could be confusing since these are not intrinsically related. We understand why [a. yes b. live] is not desirable, but perhaps there is value in designing the API so that [a. no, b. static] can be specified as well, which would make the new function a more general replacement for |
Thanks for the feedback! I understand your question - you're saying it'd be nice to allow users of the new API to get/use selection.getComposedRange({selectionRoot: componentRoot}); In both of these cases, the returned I appreciate (very much) that you didn't ask for the other permutation, returning a live |
We were under the impression that you only need to provide |
Right, the proposal started with only needing to provide LMK if that answers your question. |
Hi @mfreed7, we took another look today and we understand your reasoning and are happy with the proposal so we are going to close this. One thing we wondered about: once this is implemented are there any remaining use cases for |
Thanks! Your question is a good one, and I've raised it on the issue to gather comments. |
Braw mornin' TAG!
I'm requesting a TAG review of modifying the selection APIs to account for shadow dom.
Shadow DOM (v1) is now supported by all evergreen rendering engines. However, the user selection APIs are not well supported for the case that the user selection crosses shadow boundaries. The existing Selection API specifies that there is only a single selection in a document and the selection is bound to a single Range, which means that it cannot represent a range over the composed tree. Said another way, if the selection crosses shadow boundaries, the existing API cannot represent this situation correctly. For backwards compatibility, we also can't update the Range API to support ranges that cross shadow boundaries, because that could break existing assumptions about ranges.
This proposal suggests a new API that lets web authors control and query selections in the composed tree.
Further details:
We'd prefer the TAG provide feedback as (please delete all but the desired option):
💬 leave review feedback as a comment in this issue and @-notify @mfreed7
The text was updated successfully, but these errors were encountered: