RE: Browser discussions on selection serialization and shadow DOM

Thanks for calling attention to this work. I've subscribed to the web components issue you mentioned (I trust other folks in the Community Group also will do so / have done so), and I look forward to following developments.  Your post also provides an opportunity to highlight work in the Web Publications Working Group and in the Apache Annotator (incubating) project that may be relevant.

Hopefully the Shadow DOM will make Web Annotations easier not harder. I do not know if this will be the case. In defining and developing the various Web Annotations Selector classes our main priority was to respond to annotation use cases - see, for example, the 2014 Digital Publishing Interest Group Note on Annotation Use Cases [1].  We did anticipate that Selector extensions and refinement might be required as implementers gained experience using Selectors and as the Web Platform evolved. This Community Group is one stakeholder charged with contributing to the evolution of Selectors (as needed), so as/if developments warrant, please do raise issues in the Web Annotation GitHub repository [2].

Another overlapping and right now more active potential stakeholder group is the Web Publishing Working Group which in the next few weeks hopes to bring out 3 First Public Working Drafts, one of which is entitled, "Locators for Web Publications." The Locators document [3] is based on a Selectors and State Note published by the Web Annotation Working Group and is essentially an extended superset of Web Annotation Selectors. The Working Group may be another source of use cases. After FPWD, it may be useful to raise the Shadow DOM issue in the Locators github repository [4]. (If you don't, I probably will.)  I'm not certain how relevant it will be to development of the Locator document, e.g., will additional Selector classes or properties be needed to better accommodate or make use of Shadow DOM features? But I would rather have the issue raised and then close it as not relevant later than let this fall through the crack. 

In terms of real-world implementations, if not already aware of it, another potential stakeholder group you may want to connect with is the Apache Annotator project which is currently being incubated [5]. Good place to connect with Web annotation implementers, some of whom may have more to say about the implications and any challenges for Web Annotation posed by the shadow DOM. Benjamin Young (@bigbluehat), one of the instigators of this project, is off this week, but would be a good contact for the project.

[1] - https://www.w3.org/TR/dpub-annotation-uc/  
[2] - https://github.com/w3c/web-annotation/
[3] - https://w3c.github.io/publ-loc/ 
[4] - https://github.com/w3c/publ-loc/issues 
[5] - https://annotator.apache.org/ 

I trust you'll get additional comments on this from others in the CG. If you have other suggestions for what myself or others of us experimenting with the use of Web Annotation Selectors can do to provide feedback or otherwise help on this, please let us know. Also if you note other intersections with Web Publications Working Group work of possible interest.
 
Thanks,
Tim Cole
University of Illinois at Urbana-Champaign


-----Original Message-----
From: "J. S. Choi" [mailto:js_choi@icloud.com] 
Sent: Wednesday, November 15, 2017 8:36 PM
To: public-openannotation@w3.org
Subject: Browser discussions on selection serialization and shadow DOM

I’d like to raise awareness of a discussion that the members of this group may be interested in (https://github.com/w3c/webcomponents/issues/79). Ryosuke Niwa and Takayoshi Kochi, representatives of Apple Safari / WebKit and Google Chrome / Blink respectively, have started to discuss a matter relevant to the Web Annotations standards, particularly their Selectors.

Shadow DOM (https://www.w3.org/TR/shadow-dom/) is a new W3C standard that has, after many years of spirited debate, been finalized and already shipped in Safari and Chrome for the past year; it is in active development in Mozilla Firefox. Niwa explains (https://webkit.org/blog/4096/introducing-shadow-dom-api/):

‘Shadow DOM is a part of Web Components, a set of specifications that were initially proposed by Google to enable the creation of reusable widgets and components on the Web. Shadow DOM, in particular, provides a lightweight encapsulation for DOM trees by allowing a creation of a parallel tree on an element called a “shadow tree” that replaces the rendering of the element without modifying the underlying DOM tree. Because a shadow tree is not an ordinary child of the “host” element to which it is attached, users of components cannot accidentally poke into it. Style rules are also scoped, meaning that CSS rules defined outside of a shadow tree do not apply to elements inside the shadow tree and rules defined inside the shadow tree do not apply to elements outside of it.’

Shadow DOM has obvious ramifications for Web Annotations. A user may select content in a shadow-DOM node, but how may that selection be targeted by an annotation, if the shadow DOM is hidden from the document context?

Two browser makers (Apple and Google) are now discussing this very question. They are, in fact, discussing a “mechanism to refer to a specific position within a shadow DOM with a mechanism that can be also used to refer to a specific position in pseudo element, SVG use element's shadow tree, etc.” as well as “saving / restoring selection states (ie. serializable selection)”, which is one of the “biggest request from web-based editor authors”. This is the start of a new DOM standard—whose design is likely to make implementing and serializing Web Annotations in web browsers (especially in shadow DOM) much easier or more difficult—depending on how well it maps to the Web Annotation Data Model.

As the authors of the Web Annotation specifications, this group is a stakeholder in serializing selections on the web platform and targeting selections in DOM, including shadow DOM. It thus may be in this group’s interest to monitor this conversation (https://github.com/w3c/webcomponents/issues/79) and make sure that the browser developers are aware of use cases for annotations. I don’t know the best way in doing this except for simply staying abreast of the conversation and perhaps chiming in on its GitHub issue. I may make a comment in the thread myself, soon. I may also open a GitHub issue in the Web Annotation repository (https://github.com/w3c/web-annotation/) about shadow-DOM selections.

Warm regards,
J. S. Choi
Saint Louis University
School of Medicine

Received on Monday, 20 November 2017 23:59:18 UTC