Re: [w3c/editing] Track: Selection API for Shadow DOM (Issue #403)

The Web Editing Working Group just discussed `Selection API for Shadow DOM`.

<details><summary>The full IRC log of that discussion</summary>
&lt;Travis> Topic: Selection API for Shadow DOM<br>
&lt;Travis> github: https://github.com/w3c/editing/issues/403<br>
&lt;Travis> masonf: Hi folks! I'm masonf, TL at Google.<br>
&lt;masonf> https://docs.google.com/presentation/d/1GuO7zQlyZ3HN-tR8-qMOorukGAgLBf0MdQmaiWdfFEU/edit#slide=id.p<br>
&lt;Travis> .. (presenting slides)<br>
&lt;Travis> .. Selection API has no idea about ShadowDOM. Things don't work so well when selection crosses the boundary.<br>
&lt;Travis> .. window.getSelection does different things depending on browsers, and things are somewhat inconsistent.<br>
&lt;Travis> .. we need to add some info to selection API so it knows what to do in these cases.<br>
&lt;Travis> .. note: getRangeAt returns a Range which has to be in one tree.<br>
&lt;Travis> .. BTW, had a big discussion on this last year. TAG reviewed and was OK with it.<br>
&lt;Travis> .. Proposal: new API getComposedRange.<br>
&lt;Travis> .. returns a StaticRange.<br>
&lt;Travis> .. takes options: list of shadow roots<br>
&lt;Travis> .. (so that it knows that the author knows about them)<br>
&lt;Travis> .. another option: selection root. (Enables easy to scope scenarios)<br>
&lt;Travis> .. Proposal pt. 2. Other stuff in the Selection API that needs to be rationalized with the new changes.<br>
&lt;Travis> .. define a "true range". Platform will know the real end-points, and can adapt what it returns to conform.<br>
&lt;Travis> .. other APIs (setBaseAndExtent) can be adjusted to accept Nodes from different trees.<br>
&lt;Travis> .. (we hope that will be web-compatible)<br>
&lt;Travis> .. Presentation includes a few follow-up links at the end.<br>
&lt;Travis> Travis: what is desired from this group?<br>
&lt;Travis> masonf: Editing WG has lots of good knowledge here. Would love your feedback.<br>
&lt;Travis> .. chromium is interested in implementing.<br>
&lt;Travis> .. also, if we have volunteers to write PRs, that would be awesome.<br>
&lt;Travis> whsieh: The selection root, is it a convenience?<br>
&lt;Travis> masonf: Yes, essentially.<br>
&lt;Travis> .. must pass in (at least) your own ShadowRoot. But also, you may want to "chop off" parts of the range out of your component. So it can handle both cases.<br>
&lt;Travis> whsieh: Selection is scoped to editable regions (when it starts in an editing range)...<br>
&lt;Travis> masonf: I believe "it depends".<br>
&lt;Travis> whsieh: Silly little demo: http://whsieh.github.io/examples/contenteditable<br>
&lt;Travis> .. can't seem to make the selection cross boundaries.<br>
&lt;Travis> Megan: can select outside-in, but not vice-versa.<br>
&lt;Travis> smaug: In Firefox, highlight can be partial.<br>
&lt;Travis> snianu: Isn't that a problem with execCommands?<br>
&lt;Travis> .. e.g., delete? I guess there must be smarts to find the deletable content.<br>
&lt;Travis> smaug: How does that work in other browsers?<br>
&lt;Travis> snianu: Just the whole editing sub-component is selected (no partial selection inside) so we side-step the problem.<br>
&lt;Travis> .. behavior was different in old Edge/IE<br>
&lt;Travis> .. (Travis didn't catch the full details)<br>
&lt;Travis> .. the algorithm for adjusting the DOM is complicated.<br>
&lt;Travis> whsieh: if selection contains any non-editable ranges, then the entire thing is non-editable (presumed Firefox behavior).<br>
&lt;Travis> masonf: So is the implication that the selection root isn't necessary because it doesn't happen in practice?<br>
&lt;Travis> whsieh: The case for scoping to editable roots is a less interesting case (because all browsers already do that). There are other use cases, perhaps, where it would be useful.<br>
&lt;Travis> .. e.g., scoping to certain regions in an editor?<br>
&lt;Travis> Megan: Why StaticRange?<br>
&lt;Travis> masonf: from my POV, it was "Live Ranges" are icky.<br>
&lt;Travis> smaug: I don't think Live Ranges can have selections between different trees. This may be why.<br>
&lt;Travis> masonf: Was looking for that, but didn't find that restriction..?<br>
&lt;Travis> smaug: Well, Static Ranges may also be limited -- that part of the spec may have to change.<br>
&lt;Travis> whsieh: Another motivator is Performance.<br>
&lt;Travis> smaug: Depending on implementation, Perf may not be that significant (internal mechanism may not be able to avoid tracking logic used in live ranges)<br>
&lt;Travis> whsieh: As the number of live regions scale up, you could be in perf trouble.<br>
&lt;Travis> megan: anything we'll loose by not having live ranges?<br>
&lt;Travis> masonf: TAG said let's deprecate the old getRangeAt... but there were some unique use cases that would be lost.<br>
&lt;Travis> .. we're not losing anything by having both.<br>
&lt;Travis> masonf: Please file comments/feedback in the related issue (linked from the end of the slide).<br>
&lt;Travis> zakim, please end the meeting<br>
&lt;Zakim> As of this point the attendees have been masonf, Travis, comandeer, dandclark, snianu, smaug<br>
&lt;Zakim> RRSAgent, please draft minutes v2<br>
&lt;RRSAgent> I have made the request to generate https://www.w3.org/2022/08/11-editing-minutes.html Zakim<br>
&lt;Zakim> I am happy to have been of service, Travis; please remember to excuse RRSAgent.  Goodbye<br>
&lt;Travis> rrsagent, make logs public<br>
&lt;RRSAgent> I have made the request, Travis<br>
&lt;Travis> regrets: johanneswilm<br>
&lt;Travis> present: whsieh<br>
&lt;Travis> present: Megan<br>
&lt;Travis> rrsagent, draft the minutes<br>
&lt;RRSAgent> I have made the request to generate https://www.w3.org/2022/08/11-editing-minutes.html Travis<br>
&lt;Travis> present: Megan, whsieh, alexk, comandeer, dandclark, smaug, snianu, Travis, masonf<br>
&lt;Travis> chair: Travis<br>
&lt;Travis> rrsagent, draft the minutes<br>
&lt;RRSAgent> I have made the request to generate https://www.w3.org/2022/08/11-editing-minutes.html Travis<br>
</details>


-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/issues/403#issuecomment-1212283667
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/editing/issues/403/1212283667@github.com>

Received on Thursday, 11 August 2022 17:36:09 UTC