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…
Turn any element into a top-layer popover with light dismiss. Covers auto, manual and hint popovers, how to open them, and what Vanilla Breeze does and does not style.
Overview
The popoverattribute makes an element a popover: hidden until something opens it, then shown in the browser's top layer, above every other element whatever its z-index. Auto popovers close on light dismiss (a click outside or Escape). A button opens one with popovertarget or commandfor, with no script.
The Popover API shows and hides. It does not position: an open popover is position: fixed and the browser centres it in the viewport. Placing it next to its button is the job of CSS anchor positioning (see In Vanilla Breeze).
Applies to: any HTML element (it is a global attribute).
Auto and manual popovers
1234567891011121314
<buttontype="button"popovertarget="account-menu">Account</button><navid="account-menu"popoveraria-label="Account"><ul><li><ahref="#profile">Profile</a></li><li><ahref="#billing">Billing</a></li><li><ahref="#sign-out">Sign out</a></li></ul></nav><buttontype="button"popovertarget="draft-saved"popovertargetaction="show">Save draft</button><pid="draft-saved"popover="manual"> Draft saved at 10:42.<buttontype="button"class="ghost"popovertarget="draft-saved"popovertargetaction="hide">Dismiss</button></p>
The author CSS the demo needs
1234567891011121314
/* Surface, plus placement against the button that opened it */#account-menu,#draft-saved {inset: auto;margin: 0;margin-block-start: var(--size-2xs);position-area: block-end span-inline-end;padding: var(--size-s) var(--size-m);border: var(--border-width-thin) solid var(--color-border);border-radius: var(--radius-m);background: var(--color-surface-raised);color: var(--color-text);box-shadow: var(--shadow-l);}
Values
Value
Meaning
auto, or the attribute with no value (popover / popover="")
Light dismiss: a click outside or Escape closes it. Opening an auto popover closes the other open auto popovers, except its own ancestors, so nested menus work.
manual
No light dismiss and no Escape. It stays open until a button or script closes it. Any number can be open at once.
hint
For tooltips. Light dismiss like auto, but opening a hint closes only other hints and leaves open auto popovers alone. Usually opened by interestfor on hover or focus.
Any other value
Treated as manual. That includes hint in browsers that don't support it yet.
The attribute is not inherited: a popover's children are ordinary elements.
Opening and closing
Mechanism
Where
What it does
popovertarget="id"
<button>, button-type <input>
Opens or closes the popover with that id.
popovertargetaction
with popovertarget
toggle (default), show or hide.
commandfor="id" + command
<button>
toggle-popover, show-popover or hide-popover. The same commands also drive dialogs. See commandfor.
interestfor="id"
<button>, <a>, <area>
Opens after a short delay on hover or focus, and closes when the pointer or focus moves away. See interestfor.
showPopover(), hidePopover(), togglePopover()
script
The same actions from JavaScript. togglePopover() returns the new open state.
Two events fire on the popover: beforetoggle (cancel it to stop a popover opening) and toggle. Both carry oldState and newState ("open" or "closed"). Style the open state with :popover-open.
Examples
Hint popover opened by interest
A popover="hint" target and an interestfor invoker make a tooltip with no script of your own. Vanilla Breeze styles [popover="hint"] as a tooltip and polyfills interestfor where the browser lacks it.
Hint popover
12
<buttontype="button"interestfor="tip-save">Save</button><spanid="tip-save"popover="hint">Save your changes (Ctrl+S)</span>
Invoker commands
commandfor and command do what popovertarget does, and the same attributes open dialogs.
toggle-popover
12
<buttontype="button"commandfor="shortcuts"command="toggle-popover">Keyboard shortcuts</button><pid="shortcuts"popover><kbd>Ctrl</kbd> + <kbd>K</kbd> opens search. <kbd>?</kbd> shows this list.</p>
Nested popovers
An auto popover opened from inside another stays a child of it: opening the child keeps the parent open, and a click outside both closes both.
A popover moves between display: none and the top layer, so animate it with @starting-style and discrete transitions of display and overlay. VB's tooltip styles use exactly this pattern.
Every popover gets three structural rules and no surface. In the reset layer (src/base/reset.css), a closed popover is display: none !important, the same mechanism VB uses for [hidden], so no element, component or author display can keep it on screen, and margin: auto (zero specificity) restores the browser's centring that VB's margin: 0 reset removes. <section>, <article> and <aside> popovers are not inline-size query containers (src/custom-elements/layout-attributes.css), so they size to their content. Beyond that, VB styles two kinds of popover, both in src/native-elements/tooltip/styles.css:
[role="tooltip"][popover]: an inverted surface (--color-text background, --color-text-inverted text), --font-size-s, at most 20rem wide, a fade and slide on open and close, an optional .tooltip-arrow child, and kbd and code tinted for the dark surface. It is position: fixed and placed above its trigger: with data-anchor (which data-tooltip sets) through a named anchor, otherwise through the invoker as implicit anchor, so a plain popovertarget click tip sits at its button too. Where anchor positioning is missing, data-tooltip places it with script.
[popover="hint"] (without role="tooltip"): the same surface and the same kbd / code tints, placed above its anchor with position-area: block-start and flipped below when there is no room (position-try-fallbacks: flip-block). Its timing, 200ms to open and 100ms to close, is set on the invoker ([interestfor]), where browsers and the polyfill read it.
Both get a border in forced-colours mode and no transition under reduced motion. Components style their own popovers: <pop-over> (the shared anchored surface for <tool-tip>, <drop-down>, <combo-box>, <context-menu> and others), <date-picker>, <page-tools> and <emoji-picker>.
What a bare popover gets
Browser styles only: a solid border, a little padding and Canvas colours.
Centred. Open and un-anchored, it sits in the middle of the viewport, as in a browser without VB. Anchor it (inset: auto plus position-area and your own margin) to place it beside its button.
Hidden when closed, on any element. To show a closed popover on purpose (a sidebar that is a popover only on small screens), remove the popoverattribute at the sizes where it is a plain element; no display rule can override the reset. The dashboard layout's <nav popover> is the one framework exception.
Content-sized. A popover is not a query container, so container queries inside it resolve against the nearest container outside it.
Positioning
A button with popovertarget or commandfor becomes the popover's implicit anchor, so position-area alone places the popover next to it (the demo above does this). VB's interestfor support (src/utils/interest-polyfill.js) also writes a matching anchor-name / position-anchor pair on each invoker and target. Where anchor positioning isn't available, the polyfill and data-tooltip place the popover with script, and <pop-over> does the same for components.
VB features that read or set popover
data-tooltip (src/utils/tooltip-init.js) builds a role="tooltip" popover from a title, or wires a trigger to an existing one. Where popover="hint" isn't supported it uses manual and adds Escape and click-outside dismissal itself.
data-toggle sets aria-expanded on its button when the target is a popover.
A popovertarget button exposes whether its popover is expanded, so you don't add aria-expanded yourself.
Popovers are not modal. Focus is not trapped and the rest of the page stays usable. When a task needs the page blocked, use <dialog> with showModal() or command="show-modal".
Opening a popover doesn't move focus into it unless an element inside has autofocus. In sequential focus order the popover's content comes straight after its invoker, so Tab reaches it next.
When a popover closes while focus is inside it, focus goes back to the element that had it before, usually the invoker.
role="tooltip" is for short, non-interactive text that describes its trigger (aria-describedby), shown on hover and focus and dismissible with Escape (WCAG 1.4.13). A bubble opened by a click is a toggletip or disclosure, not a tooltip.
A list of links in a popover is navigation, not an ARIA menu. Don't add role="menu" unless you also build the arrow-key behaviour; <drop-down> does that.
Give a popover that holds a landmark or heading a name, as with aria-label="Account" on the <nav> above.
popover="hint": Chrome 151, Firefox 153; not yet in a released Safari (as of November 2026). Chrome 133–150 and Firefox 149–152 shipped an older version of the spec.
Implicit anchor from the invoker: Chrome 133, Firefox 147, Safari 26.
Gotchas
No positioning. The Popover API never places a popover beside its button. Use anchor positioning, a component such as <pop-over>, or script.
::backdrop applies to every open popover, not just manual ones. It is transparent by default; style it with [popover]::backdrop or a more specific selector.
Outside VB, closed popovers can stay visible when an author rule sets display: the browser's hiding rule is an ordinary declaration. VB re-asserts it with !important (see In Vanilla Breeze).
hint falls back to manual in older browsers: no light dismiss and no Escape. VB's data-tooltip adds dismissal back; a hand-built hint without it does not have it.
Escape closes the topmost auto or hint popover only. Manual popovers ignore it.
The target needs an id in the same tree (document or shadow root) as the button.
open — the state attribute for <details> and <dialog>.
inert — what a modal dialog does to the rest of the page.
<dialog> and <button> — the elements on either end of an invoker.
Which to choose
popover (auto) — menus of links, toggletips, pickers: anything dismissible that doesn't block the page.
<dialog> with show-modal — a task the user must finish or cancel. It makes the rest of the page inert and traps focus. Add closedby="any" for light dismiss.
popover="hint" + interestfor — a plain-text tooltip in pure HTML.
data-tooltip — upgrade a title into a positioned tooltip with an arrow.
<tool-tip> — rich tooltips and hover cards with interactive content.
<pop-over> — an anchored popover with placement options and a no-anchor-positioning fallback.
<drop-down> — an action menu with arrow-key navigation.
data-toggle — flip some other attribute (hidden, open, data-state) from a button.