-
Notifications
You must be signed in to change notification settings - Fork 120
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
Clarify how live region content be announced, given shadow DOM? #1017
Comments
@domenic is there a definition of flat tree somewhere - this is a new term to me. |
Apologies for the delay here, did some thinking / testing on this. The content of the shadow DOM should be exposed to the accessibility tree, so any changes within it should also be picked up by live regions. So, specifically to your question the flat tree should be announced as it could be problematic if content was updating / exposed in the Shadow DOM, but not available to all users. Fortunately, most current implementations seem to already be heading towards this same conclusion, with some gaps... Taking your example I created the following test page: Save for an issue specific to Firefox and JAWS, updating light or shadow DOM content in a live region was generally respected. Some other quirks are listed in the results I noted. If we can help clarify anything further, please let us know! |
It looks like there's no good definition in the specifications, which is a bit surprising. (Instead the specs just refer to specific ways of traversing the DOM tree ancestor/descendant relationships.) But an informal example can be found at https://developers.google.com/web/fundamentals/web-components/shadowdom#lightdom
Great stuff! It's good to hear that we have mostly-interoperable behavior here, and that the behavior seems pretty reasonable to me. So maybe to get this in to the spec, we should modify sections like https://w3c.github.io/aria/#aria-atomic which currently say things like (emphasis mine):
to be more specific about what they mean by "contents"? I think there are probably other parts of the spec (not just live regions, but e.g. accessible name calculation) which would also benefit from a more specific definition of contents. Maybe we need some definition like child text content or descendant text content, but operating on the flat tree? /cc @annevk as DOM editor, and @zcorpan as someone who has recently been helping with this sort of ARIA rigorization work in other issues. |
@domenic thus far flat tree has been considered a layout topic as we don't want to necessarily eagerly compute it. See https://drafts.csswg.org/css-scoping/#flattening for the current definition. Accessibility also largely operates on the "layout tree" so that's probably fine and it's mostly a matter of connecting various dots. |
So we have at least these features (are there others, in accessibility space?):
that need to take these things into account (in addition to light DOM):
(It's unclear to me if live regions should announce changes to CSS generated content though.) The "layout tree", while a concept browsers have, is not a concept that is specified, AFAIK. The flat tree is specified, but doesn't include CSS generated content. For now, specifying things in terms of the flat tree, and calling out CSS generated content where necessary, seems like a good improvement over the status quo. |
FWIW, updated my test page to include an example of injecting CSS content. Largely works the same as the previous examples. |
@jnurthen should we move this to the 1.4 milestone? |
Consider the following DOM tree:
This translates to the following flat tree
Effectively, this element has a flat tree with text content of "AB". However its light DOM children are just "A"; "B" is hidden in the shadow tree. This is somewhat analogous to some user-agent controls, where e.g. the "X" button on a search input would be hidden in the shadow DOM.
This brings up a couple interesting questions that I think are in the scope of the ARIA spec:
Thoughts appreciated!
The text was updated successfully, but these errors were encountered: