Custom states & default ARIA for slotted built-ins #10723
Labels
accessibility
Affects accessibility
addition/proposal
New features or enhancements
needs implementer interest
Moving the issue forward requires implementers to express interest
topic: custom elements
Relates to custom elements (as defined in DOM and HTML)
What problem are you trying to solve?
Web components often need to slot native elements, for example:
<button-group>
component slotting<button>
elements<x-accordion>
or<sidebar-panel>
component slotting<details>
<check-list>
slotting a<li>
(see Allow any element to be the child of a custom element (parser weirdness permitting) #10722)<checkbox-group>
slotting a<label>
<x-dropdown>
slotting an<option>
<tab-group>
or carousel component using arbitrary block elements as tab panelsIt is common to need to expose state about these slotted children to CSS (
:state()
), and in some cases to specify ARIA roles without spawning attributes (which is seen as an antipattern). However, given thatElementInternals
is only available to custom elements, there is nostates
, and no way to set default ARIA, so this cannot be done.What solutions exist today?
Components invent their own children instead of using built-ins, simply to set an ARIA attribute or to use custom states, then they have to mirror their API (and lose any heuristics about built-in elements that exist in lots of tooling or even the UA itself).
How would you solve it?
A way to attach a reduced
ElementInternals
to any element (just like a shadow tree can be attached to built-ins too)?Anything else?
No response
The text was updated successfully, but these errors were encountered: