v133 ยท dom
CSS :open pseudo-class
The :open pseudo-class matches <dialog> and <details> when they are in their open state, and matches <select> and <input> when they are in modes which have a picker and the picker is showing.
concepts
-
:open
The :open pseudo matches <details>, <dialog>, and <select> when open. Single hook for the 'is this widget showing?' question.
-
Transition coordination
Two identical accordions side by side — one styled with
:open, one without. The:openpseudo composes withtransitionto give<details>smooth expand/collapse without JS. -
:has(:open) — ancestor reacts to descendant
Page dims when any panel is open; toolbar recolours while a
<select>picker is showing. Three classic UI patterns expressible in pure CSS through:has() :open. -
Form picker indicators
Date, color, file, and select pickers all light up while their native UA picker is shown — an authoritative signal you couldn't get from focus/click heuristics before.
-
Settings Accordion
A multi-section settings panel of native
<details>elements.:opendrives the chevron rotation, active-dot indicator, row background, and count-badge hide/show โ all in CSS, zero JS class toggling. An open-section tracker reads the browser-managed[open]attribute to show which sections are currently expanded.
why it shipped
The :open pseudo-class matches <dialog> and <details> when they are in their open state, and matches <select> and <input> when they are in modes which have a picker and the picker is showing.