Re: [whatwg/dom] Declarative Shadow DOM (#831)

> > The [serialization algorithm as it currently proposed](https://github.com/whatwg/html/pull/5465) strips away all the default ARIA properties specified on [ElementInternals](https://html.spec.whatwg.org/multipage/custom-elements.html#the-elementinternals-interface) via [ARIAMixin](https://w3c.github.io/aria/#ARIAMixin). This would mean that whenever a custom element is serialized along with its shadow tree, it loses all of its default ARIA semantics. This is a pretty serious show stopper issue.
> 
> This should be doable just by more attributes on the template right? e.g. `<template shadowroot="closed" shadowroot-aria-checked="true">`

Well, sort of. The issue here is that we don't have a mechanism to specify ARIA roles on shadow roots without it being a defined custom element (i.e. it has ElementInternals). We can introduce a something new that applies to declarative shadow root that has yet to be upgraded but we need to figure out how any of that will work.

> On the note of element internals, we probably also want to be able to mirror the [form validity](https://html.spec.whatwg.org/multipage/custom-elements.html#form-associated-custom-elements) and [custom CSS states](https://wicg.github.io/custom-state-pseudo-class/) at the time of serialization.
>
> In general I imagine we'd want most new APIs that are added to `ElementInternals` to be reflected in the declarative form where possible.

Maybe? Form validity seems like more of a transient thing. e.g. even builtin form elements don't have the ability to serialize its current state, etc... we could make it serializing but I suspect that would be more of a niche. I think the same goes for CSS states since things like :hover and :focus pseudo classes are clearly transient and aren't serialized as a part of builtin elements either.

I do think there are some frameworks / use cases in which it would be desirable to serialize these things though. All the more reasons for custom elements to serialize themselves as they see fit. It's really hard for the browser / spec to make unilateral decision about these things for all applications / frameworks.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/831#issuecomment-817615089

Received on Monday, 12 April 2021 08:44:46 UTC