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

interestfor

Open a popover when the user hovers or focuses a button or link. Covers popover='hint' tooltips, delays, events, and the polyfill Vanilla Breeze ships for browsers without it.

Overview

interestfor connects an element to a target that should appear when the user shows interest: the pointer rests on it or keyboard focus lands on it. After a short delay the target opens; when interest moves away it closes again. Pointing it at a popover="hint" element gives a tooltip in plain HTML.

Applies to: <button>, <a> and <area>. The value is the id of the target, usually a popover.

Values

ValueMeaning
An idThe target. If it is a popover, it opens on interest and closes on loss of interest. Any other element just receives the events.
Empty, or no element with that idNothing happens.

Delays

Delays are set with CSS on the invoker, not on the popover. Browsers with native support read interest-delay-start, interest-delay-end and the shorthand interest-delay. VB's polyfill reads the same names as custom properties with two dashes. VB sets 200ms 100ms on every [interestfor] invoker for both (300ms / 200ms for <tool-tip variant="card">); without VB's CSS the polyfill falls back to 500ms to open and 250ms to close. Override both to get the same timing everywhere:

Events

The target receives interest when it opens and loseinterest when it closes. Natively the event's source property is the invoker; the polyfill fires a CustomEvent with the invoker in detail.source. Read event.source ?? event.detail?.source to handle both.

Examples

Definition on a link

A link keeps its normal click behaviour; interest only adds the preview.

Styling the invoker while the target is open

In Vanilla Breeze

  • Polyfill. src/utils/interest-polyfill.js ships in VB's core bundle. Where the browser has no native interestfor, it adds hover and focus handling with the delays above, closes the target on Escape, keeps it open while the pointer is over the target, opens it on a 500ms long press of a button on touch screens, and sets data-interest-polyfill on <html>. Where support is native it does nothing except the anchor names below. The polyfill accepts interestfor on any element, but native support covers only buttons, links and areas, so stick to those.
  • ARIA from the polyfill. A plain-text hint (a popover="hint" with no focusable, structural or roled content) is added to the invoker's aria-describedby. Any other target is linked with aria-details, the invoker gets aria-expanded, and a target with no interactive content and no role gets role="tooltip". Browsers with native support build this relationship themselves.
  • Positioning. When CSS anchor positioning is available, the module writes anchor-name: --interest-<id> on each invoker and the matching position-anchor on its target (both as inline styles), with native support too. Without anchor positioning the polyfill places the target above the invoker, flips it below when there is no room, and keeps it inside the viewport.
  • Hint styles. [popover="hint"] gets VB's tooltip surface, sits above its anchor with a flip-block fallback, and fades in and out (src/native-elements/tooltip/styles.css).
  • data-tooltip (src/utils/tooltip-init.js) and <tool-tip> set interestfor on their triggers when it is available (natively for buttons, links and areas, or anywhere when the polyfill is active) and fall back to their own listeners otherwise. The polyfill leaves ARIA on <tool-tip> targets to the component.

Accessibility

  • Interest covers hover and keyboard focus, and the hint can be dismissed with Escape and hovered without closing. Those are the WCAG 1.4.13 requirements for content on hover or focus.
  • A hint is a description, not a name. An icon-only button still needs its own aria-label, as the Archive button above has.
  • Keep hint content short and non-interactive. Links or buttons inside a tooltip can't be reached reliably; use a popover opened by a click, or <tool-tip variant="card">.
  • Touch users may never trigger a hint. Don't put information only in a hint that the user needs to complete a task.

Browser support

  • interestfor, the interest / loseinterest events, interest-delay and :interest-source / :interest-target: Chrome and Edge 142; not in Firefox or Safari, and still marked experimental (as of November 2026). VB's polyfill covers the other browsers.
  • popover="hint": Chrome 151, Firefox 153; not yet in a released Safari. In older browsers hint behaves like manual, so the popover still opens and closes on interest.

Gotchas

  • Delays go on the invoker. Setting --interest-delay-start on the popover has no effect.
  • kbd and code inside a bare hint keep their page styling, which is hard to read on the inverted surface. VB tints them only inside [role="tooltip"][popover]; add role="tooltip" or write the shortcut as text.
  • Use <span> or <p> for hint targets. VB gives <section>, <article>, <aside> and <nav> a display value and a size container, so as popovers they collapse or don't hide (see popover).
  • Native support ignores other elements. interestfor on a <span> works with the polyfill but does nothing in Chrome.

Related

  • popover — the target side, including popover="hint".
  • commandfor — open a popover or dialog on click.
  • Tooltips — data-tooltip and <tool-tip>.
  • <pop-over> — VB's anchored popover primitive.

Which to choose

  • interestfor + popover="hint" — a short text tooltip in pure HTML.
  • title + data-tooltip — the same result built from an existing title, with placement options and an arrow.
  • <tool-tip> — rich content, hover cards, or a configurable delay through an attribute.
  • popovertarget / commandfor — content the user opens deliberately, including anything interactive.
↑