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

reading-progress

Fixed-position scroll progress indicator bar. CSS-driven on modern browsers; passive scroll listener as fallback.

Overview

The <reading-progress> component shows a thin bar fixed to the top or bottom of the viewport that fills as the reader scrolls. It joins the doc-side family alongside <page-stats>, <page-toc>, and <page-info>.

The bar is driven by CSS animation-timeline: scroll(root block) when supported, so modern browsers update the visual without running a scroll listener. JavaScript only takes over when the browser lacks support, or when data-for bounds progress against a specific element.

Attributes

Attribute Type Default Description
data-for string — ID of the element whose top/bottom bound the progress range. Without it, tracks document scroll. Observed. If no element has that ID the bar tracks document scroll and switches to the element as soon as it appears.
data-position string top Which viewport edge anchors the bar: top or bottom. Can be changed at any time.

CSS Custom Properties

Property Default Description
--reading-progress-color var(--color-accent) Fill color of the bar.
--reading-progress-height 3px Thickness of the bar.
--reading-progress-offset 0 Distance from the anchored edge. Set it to your sticky header's height so the bar sits just below the header.
--reading-progress-z var(--z-sticky-header) Stacking order of the bar.

Usage

Track document scroll

With no data-for, the bar fills as the user scrolls the page. Modern browsers run this entirely in CSS — no scroll listener:

Bound to a specific article

Point data-for at a content element and the bar fills as that element scrolls through the viewport. This path requires JS:

Below a sticky header

Progressive Enhancement

The component layers cleanly:

  1. HTML. An optional child <progress> may be server-rendered; it is created when absent. It is always aria-hidden (see Accessibility).
  2. CSS. Modern browsers animate the bar via animation-timeline: scroll(root block). No JavaScript is needed when tracking the document.
  3. JS. When data-for is set or animation-timeline is unsupported, a passive, requestAnimationFrame-throttled scroll listener updates the bar.

The pure-CSS path always tracks document scroll. Use data-for only when the bar must reflect a specific article's reading position.

Accessibility

The bar is decorative. Screen-reader users already have their position from the scrollable document itself, and on the CSS-driven path nothing updates the inner <progress>, so exposing it would announce a stale “0%” forever. The inner <progress> is therefore aria-hidden="true" and needs no label. If a page needs an announced progress value, render a visible, labelled <progress> or text elsewhere.

In right-to-left documents the bar fills from the right. In forced-colors mode it is painted with the system Highlight colour. It is hidden in print. The fill is scroll-linked (it only moves when the reader scrolls), so it stays on under prefers-reduced-motion.

↑