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…
Button loading state with spinner, aria-busy, double-submit prevention, and auto-revert for async actions.
Overview
The data-loadingattribute on a <button> turns a button into a full loading state: a spinner replaces the button text, aria-busy is set for screen readers, and clicks are blocked to prevent double-submit. For submit buttons inside a form, the loading state activates automatically on form submission.
Preserves layout — Locks the button width to prevent shift when content changes.
Shows a spinner — Replaces button content with an animated spinner and optional loading text.
Sets accessibility state — Adds aria-busy="true" and aria-disabled="true". It deliberately does not set disabled: that would drop the submitter's name/value from the form data and move focus to <body>.
Auto-reverts — Restores original content when the action completes or after a safety timeout.
Enable loading enhancement. Optional value is the loading text (e.g. "Saving..."). Empty shows spinner only.
data-loading-timeout
number
Auto-revert after N milliseconds. Default: 10000 (10 seconds).
Form Integration
Submit buttons inside a <form> automatically activate on form submission. When paired with the form coordinator (data-submit="fetch"), the button auto-reverts when the submission completes.
During loading (see ARIA states for how VB styles these):
aria-busy="true" tells screen readers the button action is in progress.
aria-disabled="true" announces the button as unavailable; further clicks and key presses are swallowed while it is busy, and focus stays on the button.
The spinner is marked aria-hidden="true" so it doesn’t interfere with screen reader output.
The spinner animation slows to 1.5s under prefers-reduced-motion.
Containers vs Buttons
The data-loadingattribute serves two purposes depending on the element:
Element
Visual
Behavior
Container (<section>, <div>)
Shimmer overlay, skeleton
CSS-only, no JS needed
Button (<button>)
Inline spinner, disabled state
JS-enhanced with auto-revert
Related
disabled — what the native attribute does, and why a busy button should not use it.
formaction — per-button submission overrides; the busy submitter still sends its name and value.