Re: [WICG/webcomponents] Interaction between ElementInternals (e.g. default ARIA) and declarative shadow DOM (Issue #972)

Today in the AOM meeting we discussed (4) – i.e., should the `ElementInternals` attribute (whether microsyntax or not) be defined on A) the custom element or B) its `<template shadowroot>`?

Arguments in favor of A:

- There aren't many great use cases for using `ElementInternals` in a shadowless component.
- `ElementInternals` exposes the element's `shadowRoot` (if one is attached).

Arguments in favor of B:

- `ElementInternals` are usable today with shadowless components. So this would create a mismatch between what you can do imperatively vs declaratively.

My personal preference is B, if only to have symmetry with the imperative use case. If there aren't many great use cases for `ElementInternals` in shadowless components, then that's a problem with `ElementInternals` in general and not specifically about the declarative use case.

Also, I do have a [rough sketch](https://codepen.io/nolanlawson-the-selector/pen/rNvEXME) of a shadowless component using `ElementInternals`. In this case, it's an element with a default role of `button` and default `aria-label`.

Maybe a developer would use this technique if 1) they didn't want to use shadow DOM for various reasons, or 2) their custom element only needs one DOM node anyway. In this case, the component author could have a default `role` and `aria-label`:

```html
<my-button></my-button> < !-- implicit role=button and aria-label="I am a button" -->
```

... but the consumer could override it.

```html
<my-button role="tab" aria-label="I am a tab"></my-button>
```

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

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

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

Received on Thursday, 20 October 2022 21:51:00 UTC