[WICG/webcomponents] Can ElementInternals have ARIA IDREFs pointing inside the shadow root? (Issue #974)

`ElementInternals` is [defined](https://html.spec.whatwg.org/multipage/custom-elements.html#the-elementinternals-interface) as having an [ARIAMixin](https://w3c.github.io/aria/#ARIAMixin). This means it would get all the `Element`- and `FrozenElement`-reflecting properties like `ariaLabelledByElements` and `ariaActiveDescendantElement`.

Should these IDREFs be situated in 1) the shadow root attached to the custom element, or 2) the containing document or shadow root of the custom element?

Arguments in favor of (1):

- There aren't many use cases (?) for using `ElementInternals` in a shadowless component.
- `ElementInternals` exposes the element's `shadowRoot` (if one is attached).
- This gives developers more flexibility in setting default `aria*` IDREFs 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).

Another question is how this would interact with [cross-root ARIA delegation](https://github.com/leobalter/cross-root-aria-delegation), since there is a lot of overlap.

## Current browser implementations

Currently in Chrome Canary 109 with "experimental web platform features" enabled, `ariaLabelledByElements` is defined on `ElementInternals`. However, setting it to an array of elements inside the shadow root causes the tab to crash 🙂  ([Codepen](https://codepen.io/nolanlawson-the-selector/pen/WNJqqXO)). I was not able to get WebKit Nightly to run.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/974

You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/974@github.com>

Received on Thursday, 20 October 2022 21:34:41 UTC