Re: [csswg-drafts] [selectors] Add `:open` or `:top-layer` pseudo class (#7319)

Per the resolution, we'd like to add `:open`, but need to define it better.

I spoke to @tabatkins, who came up with this definition:

> The `:open` pseudo-class represents an element that has both "open" and "closed" states, and which is currently in the "open" state. Exactly what "open" and "closed" mean is host-language specific, but exemplified by elements such as HTML's `<details>`, `<select>`, and `<dialog>` elements, all of which can be toggled "open" to display more content (or any content at all, in the case of `<dialog>`).
>
> Note: Being "open" is a semantic state. An element not currently being displayed (for example, if it is in a `display: none` container) can still be "open" and will match `:open`.

I love this definition, as I think it captures a concept of "openness" that lines up with what most developers think "open" means. I also think it makes it relatively straightforward for HTML to connect it to specific elements.

What do folks think?

Should we also talk about adding the corresponding `:closed` pseudo class? That would avoid the problem that `:not(:open)` can match anything, including things that don't open or close.

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


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

Received on Friday, 9 September 2022 19:25:17 UTC