Re: [csswg-drafts] [selectors] Declarative custom `:state()` states (#12502)

Should setting state be a concern of CSS? I am very interested in a declarative way of doing this for custom elements, but I had imagined that being a part of Declarative Custom Elements and not CSS, since state is usually related to semantics (e.g. I would reflect `this.#internals.ariaExpanded = true` as `:state(expanded)`).

I’m definitely a fan of having custom selectors in some way though. Maybe something in the direction of `:alias()`/`@alias` could work?

Initially, I wondered if CSS Shadow Parts might be more appropriate to expand to the light DOM and make declarative (via CSS), but I imagine there would be issues complex selectors as `::part()` is more limited.

-- 
GitHub Notification of comment by knowler
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12502#issuecomment-3091316126 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 19 July 2025 00:42:10 UTC