Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

open

The boolean state attribute of details and dialog: whether a disclosure is expanded or a dialog is showing. Covers exclusive accordions, modal versus non-modal dialogs, closedby, and VB's open and close animation.

Overview

open is a boolean attribute that reflects whether something is showing. On <details> it means the content below the <summary> is expanded; the browser adds and removes it as the user toggles. On <dialog> it means the dialog is shown; the browser sets it when you open the dialog, and you should open and close dialogs with their methods or commands, not by editing the attribute.

Applies to: <details> and <dialog>.

Values

ElementPresentAbsent (default)
<details>Expanded: the content is shown.Collapsed: only the summary shows.
<dialog>Shown. In markup, or from show(), it is non-modal; only showModal() or command="show-modal" makes it modal.Not shown.

As a boolean attribute, any value (even open="false") means open. The open property reflects it.

Dialog: ways to open

HowModalTop layer and backdropRest of page inertEscape closes
open in markup, or show()NoNoNoNo (unless closedby allows it)
showModal() or command="show-modal"YesYesYesYes

Dialog: closedby

closedbyCloses on
anyLight dismiss (a click outside), Escape or other close requests, and script or close commands.
closerequestEscape or other close requests, and script. The default for modal dialogs.
noneOnly script or a close command. The default for non-modal dialogs.

Examples

Modal and non-modal dialogs

The modal opens from an invoker command and closes on a backdrop click (closedby="any"). There is no command for a non-modal dialog, so that button calls show() from a module script.

Reacting to the open state

Both elements fire toggle when open changes, by the user or by script. It fires after the change and can't be cancelled, so read the open property in the handler.

Styling by state

In Vanilla Breeze

Details (src/native-elements/details/styles.css)

  • A bordered, rounded box. Adjacent <details> join into one group, except inside gap-based layouts.
  • The <summary> marker is replaced by a chevron (summary::after) that points to the inline end when closed and down when [open], mirrored in right-to-left text.
  • Opening and closing animate. ::details-content transitions block-size from 0 to auto, which needs interpolate-size: allow-keywords (set on :root in src/tokens/motion.css). Only Chromium supports interpolate-size; other browsers open and close instantly.
  • In print, every <details> prints expanded (src/utils/print.css).

Dialog (src/native-elements/dialog/styles.css)

  • dialog[open] lays out as a flex column: header and footer keep their size and the body scrolls. A closed dialog keeps the browser's display: none.
  • Opening and closing fade and scale, with @starting-style and discrete display / overlay transitions. ::backdrop uses --color-backdrop and a --backdrop-blur blur, fading in step.
  • data-size and data-position give size variants and drawers; see the <dialog> page. Dialogs are hidden in print.

<accordion-wc> and <tab-set> are built on <details>, and data-toggle="open" can flip the attribute from a separate button.

Accessibility

  • <summary> is announced as an expandable control with its expanded or collapsed state. It is focusable and works with Enter and Space; don't add roles or aria-expanded to it.
  • In supporting browsers (see Browser support), find-in-page searches closed <details> and opens the one that matches, so collapsed content stays findable.
  • Use a modal dialog (showModal() or command="show-modal") for anything that must be dealt with first. It moves focus in, makes the rest of the page inert, and returns focus to the opener on close. A dialog opened with the open attribute does none of that.
  • Name every dialog with aria-labelledby pointing at its heading.

Browser support

  • open on <details> and <dialog>: supported in all current browsers.
  • name for exclusive <details> groups: Baseline 2024 (Chrome 120, Firefox 130, Safari 17.2).
  • ::details-content: Baseline 2025 (Chrome 131, Firefox 143, Safari 18.4). interpolate-size: Chrome 129 only.
  • Find-in-page opening closed <details>: Chrome 97, Firefox 148, Safari 26.2 (partial).
  • closedby: Chrome 134, Firefox 141; not yet in a released Safari (as of November 2026).

Gotchas

  • Don't remove open to close a dialog. The spec advises against it: removing the attribute bypasses the dialog's proper close steps (such as the return value and focus handling). Call close() or requestClose(), or use a close / request-close command.
  • open in markup makes a non-modal dialog: not in the top layer, without a backdrop, and with the page still usable around it. That is rarely what you want for a dialog that should demand attention.
  • toggle can't stop the change. It fires after the state has changed.
  • An exclusive group needs the same name and works only between <details> elements in the same document or shadow root. If the markup has several open in one group, the browser closes all but the first.

Related

Which to choose

  • <details> — one disclosure, or a few with name for an exclusive group.
  • <accordion-wc> — an accordion with keyboard navigation between headers, indicator styles and transition options.
  • <tab-set> — panels where one is always showing and the labels sit in a row.
  • <dialog> with show-modal — a task that blocks the page until it is done.
  • popover — a menu, picker or panel that can be dismissed and doesn't block the page.
↑