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

ARIA states

The ARIA state attributes Vanilla Breeze styles or sets: aria-current, aria-pressed, aria-expanded, aria-disabled, aria-busy, aria-invalid, aria-sort, aria-selected and aria-keyshortcuts.

Overview

ARIA state attributes tell assistive technology what state an element is in: the current page, a pressed toggle, an open menu. Vanilla Breeze styles the visible state from the same attributes, so what users see and what screen readers announce cannot drift apart. Many VB components and data-* enhancers also set these attributes for you.

Rule one: use the native element or attribute first. disabled before aria-disabled, <details> before aria-expanded, <select> before aria-selected, :user-invalid before aria-invalid. Reach for ARIA when no native feature expresses the state.

Applies to: each attribute is allowed on the roles listed in the WAI-ARIA 1.2 specification. The tables below give the elements VB styles.

Values

AttributeValuesDefaultNative first
aria-currentpage, step, location, date, time, true, falsefalseNo native equivalent
aria-pressedtrue, false, mixedabsent: not a toggleA checkbox or switch (input[data-switch]) when it is a setting rather than an action
aria-expandedtrue, falseabsent: not expandable<details>, popovertarget (the browser exposes the state)
aria-disabledtrue, falsefalsedisabled
aria-busytrue, falsefalseNo native equivalent
aria-invalidtrue, false, grammar, spellingfalseConstraint validation (required, pattern, :user-invalid)
aria-sortascending, descending, none, othernoneNo native equivalent
aria-selectedtrue, falseabsent: not selectable<select> / <option selected>, radio buttons
aria-keyshortcutsSpace-separated key combinations, e.g. Control+S Meta+SnoneNo native equivalent (accesskey creates a shortcut but does not describe one)

Examples

aria-current

Marks the current item in a set: the page in navigation, the step in a process, today in a calendar. Use the most specific value. VB styles it on navigation links, so the current item is highlighted and announced from one attribute.

Styled in VB: nav a[aria-current="page"] and nav [aria-current="page"] > a (fill, colour and a locked underline as the non-colour cue), plus the .tabs, .breadcrumb, .pagination, .tree and .steps (aria-current="step") variants (src/native-elements/nav/styles.css); data-paged page buttons (src/utils/data-paged.css); <page-toc> (aria-current="true"), <bread-crumb>, <nav-bar>, <date-picker>, <week-view> and <data-table> (their styles.css).

Set for you by: <nav-bar> (the link matching the URL), <bread-crumb> (the last crumb), <page-toc> (the section in view), data-paged controls (src/lib/data-paged-controls.js), the form wizard step list (src/lib/wizard.js), <carousel-wc>, <calendar-wc> and <date-picker>.

aria-pressed

Turns a <button> into a toggle button. Keep the label constant ("Mute alerts") and let the state change; do not also change the label to "Unmute".

Styled in VB: button[aria-pressed="true"] gets the active fill and an inner shadow; .secondary fills with the button colour, .ghost with the subtle tint, and forced-colours mode uses SelectedItem (src/native-elements/button/styles.css). menu.toolbar keeps pressed ghost buttons from losing their state on hover (src/native-elements/menu/styles.css).

Set for you by: data-toggle="aria-pressed" (flips true/false), list-mode data-sortable buttons (the active sort), and many components' toolbar buttons (<video-player>, <audio-player>, <reader-view>, <text-reader>, <highlight-wc>…).

aria-expanded

Says whether the thing a control opens is open. Put it on the control, not on the panel.

Styled in VB: dropdown triggers inside <nav> keep their hover fill while open and rotate their chevron (src/native-elements/nav/styles.css); <drop-down>, <bread-crumb>, <glossary-wc> and <version-switcher> style their own triggers.

Set for you by: data-toggle (when its target is a popover, or when it toggles data-state to an open value), data-spoiler, <tool-tip>, <accordion-wc>, <drop-down>, <combo-box>, <site-search>, <context-menu>, <command-palette> and other menu and picker components.

aria-disabled

Looks and is announced as disabled, but stays focusable, so users can find the control and read why it is unavailable. The browser does not block activation: your script must ignore clicks. Prefer disabled when nobody needs to discover the control.

Styled in VB: button:is(:disabled, [aria-disabled="true"]) gets half opacity and a not-allowed cursor, and hover and active fills are suppressed (src/native-elements/button/styles.css); disabled wizard steps (src/native-elements/form/wizard.css) and many component items.

Set for you by: data-loading (with aria-busy, instead of disabled, so the submitter's name and value still reach the form data, src/utils/loading-button-init.js), the form coordinator on the submit button while a fetch submission runs (src/lib/form-coordinator.js), and the form wizard's step list.

aria-busy

Says an element is being updated. On a button it marks work in progress; on a region it asks screen readers to wait before announcing changes.

Styled in VB: button[aria-busy="true"] and .button[aria-busy="true"] get a wait cursor, ignore pointer events and dim slightly (src/native-elements/button/styles.css); <theme-picker> and <popularity-index> style their busy states.

Set for you by: data-loading, the ticker effect, and components that fetch or stream content (<include-file>, <card-list>, <activity-feed>, <ai-chat>, <poll-wc>…).

aria-invalid

Marks a field whose value failed validation. Native constraint validation already exposes invalid state to assistive technology; VB adds aria-invalid where the browser's state is not enough, such as server-side errors.

Styled in VB: inputs, selects and textareas with [aria-invalid="true"] get the same treatment as :user-invalid, an error-coloured border with a thicker inline-start edge (a double border in forced-colours mode) (src/native-elements/input/styles.css); switches too (src/native-elements/input/switch.css).

Set for you by: <form-field>, which mirrors its invalid state (including an authored data-invalid) onto the control, and the form coordinator, which marks bare controls (outside <form-field>) on submit (src/lib/form-coordinator.js); also <combo-box>, <date-picker> and <time-picker>.

aria-sort

Put it on the one column header that the table is currently sorted by. Other headers have no aria-sort or none.

Styled in VB: th[data-sort] draws ⇅, ↑ or ↓ from aria-sort, with empty alternative text so the arrow is not announced twice. With a sort button inside (added by data-sortable or <data-table>) the neutral ⇅ shows on unsorted columns; a bare server-sorted header shows only ↑ or ↓ (src/native-elements/table/styles.css).

Set for you by: data-sortable and <data-table>.

aria-selected

The selected item in a listbox, grid, tab list or tree. VB styles it only inside its own components (<combo-box>, <date-picker>, <site-map>, <notification-wc>), which also set it, as do <command-palette>, <site-search> and <calendar-wc>. For your own markup, a <select> or a group of radio buttons is almost always the right element.

aria-keyshortcuts

Describes a keyboard shortcut that script handles, so screen readers can announce it. It creates nothing by itself. VB does not style it.

Set for you by: data-hotkey action bindings (src/utils/hotkey-action-init.js; your own value wins), <context-menu> items, <command-palette> commands, <selection-menu>, <video-player> and <audio-player>.

In Vanilla Breeze

  • State styles read the attribute. VB never uses a class for these states, so there is one source of truth. The one exception is nav a.active, accepted for site generators that cannot add attributes.
  • Only "true" counts. Selectors test [aria-pressed="true"], [aria-busy="true"] and so on, so aria-pressed="false" is styled as unpressed. aria-current rules match "page", "step" or "true" as listed above.
  • Forced colours. Pressed and disabled buttons switch to system colours (SelectedItem, GrayText) so the state survives Windows High Contrast.
  • Companions. data-toggle flips two-state ARIA attributes without custom script; data-loading manages busy and disabled on submit buttons; <form-field> manages aria-invalid and aria-describedby.

Accessibility

  • Native first. A native element or attribute gives you the state, the keyboard behaviour and the announcement together. ARIA only changes the announcement.
  • disabled or aria-disabled? disabled removes the control from the Tab order and blocks activation. aria-disabled="true" keeps it focusable so its reason can be read; you must block activation yourself.
  • A <button>, not a role="button". aria-pressed and aria-expanded belong on a real <button>, which brings focus and Enter/Space for free.
  • Keep state and visuals in step. Set the attribute and let CSS follow it, as VB does. Do not toggle a class and an attribute separately.
  • Colour is not enough. VB pairs state colours with a second cue: an underline for the current nav item, an inner shadow for pressed buttons, a thicker border for invalid fields, arrows for sorted columns.

Gotchas

  • aria-pressed and aria-expanded on the same button conflict. A toggle is pressed; a disclosure is expanded.
  • aria-current on more than one item in the same set is a bug.
  • aria-busy on a large region can silence its live updates until you clear it. Always set it back to false or remove it.
  • aria-sort on several columns is allowed by the spec but confuses users; mark only the primary sort.

Related

Which to choose

  • Native attribute (disabled, open, selected, required) — whenever one exists.
  • ARIA state — states HTML has no attribute for: current, pressed, busy, sort.
  • VB enhancer (data-toggle, data-loading, data-sortable, <form-field>) — when you want the ARIA state managed for you.
↑