-
Notifications
You must be signed in to change notification settings - Fork 378
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
Can ElementInternals have ARIA properties pointing inside the shadow root? #974
Comments
Related: there is a PR on HTML to add ARIA prop/attr reflection to ElementInternals: whatwg/html#8496 Based on my reading, this would implement (2) as there is no reference to shadow roots and instead only references to the element (host) of the ElementInternals. |
@nolanlawson I don't fully understand this issue. One thing though, in some scenarios, the only way to grab the shadowRoot instance is by using |
@caridy I added an example to clarify. Keep in mind that So it's important to know whether the owning |
Related discussion: whatwg/html#8544 |
this.attachInternals().ariaDescribedBy = 'foo' I don't see how this could work as the ID search would happen within the node tree. But if you point directly to an element I think it can work and we should make it work. In fact, any element that shares the same shadow-including root ought to be fine as |
@annevk Thanks, you're right, I was not thinking this through clearly. A better example would be using (I also realized IDREFs for ElementInternals do not make much sense, since they accept ARIA properties and not ARIA attributes. And |
Closing as I think this is answered pretty clearly in whatwg/html#8544 (comment). |
ElementInternals
is defined as having an ARIAMixin. This means it would get all theElement
- andFrozenElement
-reflecting properties likeariaLabelledByElements
andariaActiveDescendantElement
.For the purposes of determining the valid attr-associated elements, should the "location" of the ElementInternals be considered as 1) the shadow root attached to the custom element, or 2) the containing document or shadow root of the custom element?
In other words, can you do this?
Arguments in favor of (1):
ElementInternals
in a shadowless component.ElementInternals
exposes the element'sshadowRoot
(if one is attached).aria*
attr-associated elements to point to elements inside of the shadow root.Arguments in favor of (2):
ElementInternals
is, in fact, usable today with shadowless components. So it may be a bit strange for IDREFs to be able to peek into the shadow root (but only if it exists).aria*
properties to a component's own shadow root. (Typically, it would probably point to something outside.)Another question is how this would interact with cross-root ARIA delegation, since there is a lot of overlap.
Current browser implementations
Codepen
attachInternals
Edit: updated the description to provide better examples and avoid mentioning IDREFs, since this isn't really about IDREFs.
The text was updated successfully, but these errors were encountered: