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

settings-panel

Compact, non-modal site settings panel with a gear trigger and accordion sections: appearance, accessibility, layout, effects, system, and environment on pages that use the ambient pack.

Overview

A compact settings panel opened from a gear button. It is built from native <details> sections that share a per-instance name, so only one section is open at a time. The sections hold theme selection, accessibility toggles, layout options, effects, system information and, on pages that use the ambient pack, its opt-out.

It runs alongside <theme-picker>, which covers only color mode and theme. Both components read and write the same ThemeManager state and listen for vb:theme-change, so a mode or theme picked in one shows up in the other on the same page. Everything else (accessibility themes, layout, effects, the ambient opt-out) is set here. Other tabs are not synced: there is no storage listener, so a second tab picks up changes when it reloads.

Attributes

Attribute Type Default Description
open boolean — Reflected state, set by open(), close() and toggle(). Don't author it.
data-label-* string English Overrides for every visible or announced string. See Labels.

Child attributes

Attribute On Description
data-trigger <button> Marks your own trigger. Without one, the first child <button> is used, and if there is none, a gear button is generated. The runtime sets aria-haspopup="dialog", aria-expanded and aria-controls on the trigger.

Panel Sections

The panel has six collapsible <details> sections. Only one is open at a time, and Appearance starts open.

Appearance

  • Color Mode — segmented control: Auto, Light or Dark (ThemeManager.setMode).
  • Theme — a <select> grouped with <optgroup> from the shared theme list (ThemeManager.setBrand). Active accessibility themes are re-applied on top of the new theme.

Accessibility

Toggle switches (input[data-switch="s"]) that add the theme to <html data-theme> after the brand theme:

  • High Contrast (a11y-high-contrast)
  • Large Text (a11y-large-text)
  • Dyslexia-Friendly (a11y-dyslexia)

The section also has a Single-Key Shortcuts switch (WCAG 2.1.4 Character Key Shortcuts). Turning it off sets <html data-char-shortcuts="off"> and stores charShortcuts: false in vb:settings:extensions. Every unscoped single-character shortcut then stops firing: data-hotkey actions such as /, the ? key of <short-cuts>, and any component that binds shortcuts through VB's hotkey binder. Shortcuts with Ctrl, Cmd or Alt keep working. The stored choice is restored as soon as the hotkey code loads. With no stored choice, an authored data-char-shortcuts="off" on <html> is the starting state.

Layout

  • Fluid Scaling — on or off. When it's off, static token values are used.
  • Density — Compact, Default or Spacious. Shown only when fluid scaling is on.
  • Canvas Backdrop — on or off. When it's on, these controls also appear:
    • Style — Default, Flush or Elevated.
    • Chrome — Card, Stretch or Integrated.
    • Fixed Header — adds fixed to the backdrop chrome value.
    • Page Background — Theme Default, Solid Color (one color input) or Gradient (start color, end color and a direction <select>).
  • Sticky Navigation — toggles <html data-sticky> and starts or stops the sticky manager. The panel touches only the root attribute. The sticky manager owns the banner header's data-sticky: it adds the attribute only when it's missing and removes only what it added. A header you wrote data-sticky on yourself is never changed.

Effects

  • Motion Effects (default on). Turning it off sets <html data-motion-reduced>.
  • Sound Effects (default off). The sound manager is loaded only when this is turned on.

Environment

  • Ambient Styling (default on)

This section appears only on a page that opts in to the ambient pack with <html data-ambient="…">. The switch is the visitor's opt-out: turning it off stores the choice in localStorage and removes the season, daypart, weather and occasion state from the page. The panel does not load the pack; it sets the preference the pack reads.

System

  • The Vanilla Breeze version.
  • The service-worker status, in a role="status" line.
  • Clear Cache and Check for Updates buttons. Their results are announced through a polite live region.

The Reset to Defaults button in the footer asks for confirmation inside the panel, with Reset and Cancel buttons; there is no browser confirm(). Confirming resets ThemeManager, clears the accessibility, effects and sticky preferences, and clears an ambient opt-out. Sticky navigation goes back to the page's authored state. The reset is announced.

Custom Trigger

Provide your own trigger button as a child element with data-trigger. If no trigger is found, a gear icon is generated.

Footer Integration

The usual place for the panel is next to the footer's legal links. The panel opens upward from the trigger, and downward when there isn't room above.

Labels

Every string the panel renders or announces can be overridden with data-label-<key> on the element. Values are inserted as text, not as HTML. {n} in data-label-sw-active is replaced with the number of cached files. An authored trigger keeps its own accessible name; data-label-trigger applies only to the generated gear.

Attribute Default
data-label-triggerSite settings
data-label-dialogSite settings
data-label-titleSettings
data-label-closeClose settings
data-label-appearanceAppearance
data-label-color-modeColor mode
data-label-mode-autoAuto
data-label-mode-lightLight
data-label-mode-darkDark
data-label-themeTheme
data-label-accessibilityAccessibility
data-label-high-contrastHigh Contrast
data-label-large-textLarge Text
data-label-dyslexiaDyslexia-Friendly
data-label-char-shortcutsSingle-Key Shortcuts
data-label-layoutLayout
data-label-fluidFluid Scaling
data-label-densityDensity
data-label-density-compactCompact
data-label-density-defaultDefault
data-label-density-spaciousSpacious
data-label-backdropCanvas Backdrop
data-label-backdrop-styleStyle
data-label-backdrop-defaultDefault
data-label-backdrop-flushFlush
data-label-backdrop-elevatedElevated
data-label-chromeChrome
data-label-chrome-cardCard
data-label-chrome-stretchStretch
data-label-chrome-integratedIntegrated
data-label-fixed-headerFixed Header
data-label-page-bgPage Background
data-label-page-bg-defaultTheme Default
data-label-page-bg-colorSolid Color
data-label-page-bg-gradientGradient
data-label-bg-colorColor
data-label-grad-startStart
data-label-grad-endEnd
data-label-grad-directionDirection
data-label-dir-to-bottomTop → Bottom
data-label-dir-to-rightLeft → Right
data-label-dir-135degDiagonal ↘
data-label-dir-45degDiagonal ↗
data-label-stickySticky Navigation
data-label-effectsEffects
data-label-motionMotion Effects
data-label-soundsSound Effects
data-label-environmentEnvironment
data-label-ambientAmbient Styling
data-label-systemSystem
data-label-sw-labelService Worker:
data-label-sw-checkingchecking…
data-label-sw-unsupportedNot supported
data-label-sw-activeActive ({n} cached files)
data-label-sw-unregisteredNot registered
data-label-clear-cacheClear Cache
data-label-clearingClearing…
data-label-clearedCache cleared
data-label-check-updateCheck for Updates
data-label-checkingChecking…
data-label-update-availableUpdate available
data-label-up-to-dateUp to date
data-label-failedFailed
data-label-resetReset to Defaults
data-label-reset-confirmReset all settings to defaults?
data-label-reset-yesReset
data-label-reset-cancelCancel
data-label-reset-doneSettings reset to defaults

JavaScript API

Member Type Description
open() method Opens the panel and moves focus into it. If the element hasn't rendered yet (it isn't connected), the call is queued until it renders.
close() method Closes the panel. If focus is inside the panel it returns to the trigger; focus that is elsewhere is not moved.
toggle() method Opens the panel if it's closed and closes it if it's open.
data property { a11yThemes, extensions: { motionFx, sounds, charShortcuts }, sticky }. Setting it applies each field you provide to the page straight away, writes it to VBStore and updates the controls. It works before the panel renders.

Events

Event Target Detail
settings-panel:upgraded host —
settings-panel:data-changed host { data, source: 'property' }, fired after the data setter's writes finish
vb:a11y-themes-change window string[] of active accessibility themes
vb:extensions-change window { motionFx, sounds, charShortcuts }

State Sharing

<settings-panel> shares state through these channels. <theme-picker> uses the first (mode and theme); a second panel, or your own controls, can use all three. When a window event arrives, the panel applies the event's detail before it updates its controls. That way it never shows stale values, and it never writes stale values back.

Channel localStorage key Window event
Theme (mode, brand, fluid, backdrop, page background) vb:theme:current (ThemeManager) vb:theme-change
Accessibility themes vb:settings:a11y vb:a11y-themes-change
Effects and shortcuts (motion, sound, single-key shortcuts) vb:settings:extensions ({ motionFx, sounds, charShortcuts }) vb:extensions-change
Sticky navigation vb:settings:sticky ("on" / "off") —

The VBStore values are wrapped in a { data, timestamp } envelope. The site's head script restores a stored sticky "on" before first paint.

Keyboard Navigation

Key Action
Enter / Space on the trigger Open the panel and move focus into it
Tab / Shift+Tab Move through the controls. Tabbing out of the panel closes it.
Escape With focus on the trigger or inside the panel: close the panel and return focus to the trigger

Accessibility

  • The panel is a non-modal role="dialog", named by data-label-dialog (default "Site settings"). When it opens, focus moves to the panel. It does not trap focus, because the page behind it stays usable: tabbing out, clicking outside or pressing Escape (with focus on the trigger or in the panel) closes it. Whenever it closes while focus is inside it, focus returns to the trigger, so focus is never left on a hidden control.
  • The trigger has aria-haspopup="dialog", aria-controls and an aria-expanded that tracks the open state, including across a remove and reinsert.
  • Color mode, density, backdrop style and chrome are radio groups inside <fieldset> elements with visually hidden <legend>s. Their radio names and the control ids carry a per-instance suffix, so two panels on one page don't share groups or labels.
  • Toggle switches are native <input type="checkbox" data-switch="s"> elements inside their <label>.
  • The service-worker status line is role="status". Clear Cache, Check for Updates and Reset results are announced through a visually hidden live region.
  • Reset asks for confirmation inside the panel and moves focus to Cancel.

Related

↑