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

data-container

Make any element a CSS size-query container (container-type: inline-size), optionally named card, panel or media, and keep sectioning children of content-sized layouts as containers on purpose.

Overview

data-container sets container-type: inline-size on the element, so @container queries and cqi units inside it measure the element instead of the viewport. A value names the container, so component CSS can target it with @container card (…) rather than the nearest anonymous container.

It has two jobs:

  1. Opt in — make a non-sectioning element (a li, a figure, a custom element) a query container.
  2. Escape hatch — keep a main, article, section or aside a container inside the layouts where VB otherwise switches containment off.

Values

ValueCSSQuery with
(bare) data-containercontainer-type: inline-size@container (width < …) (anonymous)
card+ container-name: card@container card (…)
panel+ container-name: panel@container panel (…)
media+ container-name: media@container media (…)

VB itself ships no rules that query card, panel or media; the names are for your component CSS. For any other name, set container-name in your own CSS alongside the bare attribute.

Where it applies

VB already makes every main, article, section and aside (except floated aside.float / aside.sidenote) an inline-size container, so on those elements the bare attribute is only needed as an escape hatch. Size containment ignores the element's content when working out its width, so a container that is sized by its content collapses to zero width. VB therefore removes containment from sectioning elements that are direct children of:

  • <layout-cluster> / data-layout="cluster"
  • <layout-reel> / data-layout="reel"
  • <layout-cover> / data-layout="cover" with data-layout-centered
  • <layout-stack> / data-layout="stack" with data-layout-align start, center or end
  • <layout-grid> / data-layout="grid" with data-layout-subgrid, for a different reason: a query container is laid out independently and cannot be a subgrid, so its rows would not line up with its siblings'

Adding data-container to such a child excludes it from that reset, so it stays a container. In the flex layouts, give it a width (an explicit inline-size, a flex-basis, or a --layout-* one-off), or it collapses; in a subgrid, it keeps its width but sizes its own rows.

The same escape hatch applies to text layouts: a <layout-text>, data-layout="prose", layout-columns or article[data-measure] host stops being a container while it holds a data-bleed child (so the child can measure the outer container). data-container on the host keeps it a container.

Related container names

Page and main-level layouts name their regions for you; you do not need data-container on them. See data-page-layout (region-main, region-nav, region-aside) and Grid Identity (region-main-*).

Accessibility

  • data-container changes only how size is measured; it adds no role and no semantics.
  • Container queries respond to the space a component actually has, which also covers zoom and large text: at 200% zoom or with a larger root font size, containers measured in rem narrow and components switch to their compact form instead of overflowing (WCAG 1.4.10 Reflow).
  • When a query reorders content visually (for example with order or grid placement), keep the DOM order meaningful so keyboard and screen-reader order still match.

Related

↑