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

glossary-index

Interactive glossary wrapper with live search filtering and scroll-spy letter tracking; copyable term permalinks are optional.

Overview

The <glossary-index> component wraps a static <dl>-based glossary to add live search filtering and scroll-spy active letter tracking. A glossary is mostly linked to: a term in prose links to its entry here, and the entry it lands on is highlighted. Without JavaScript, the glossary is fully readable with anchor link jump navigation.

Attributes

AttributeTypeDefaultDescription
placeholderstring"Filter terms…"Placeholder hint for the search input
permalinksboolean—Add a copy-link # beside each term that has an id (off by default)
data-label-filterstring"Filter glossary terms"Accessible name of the search input (a placeholder is not a label)
data-label-matches-one / -otherstring"{count} term matches" / "{count} terms match"Polite match-count announcement (Intl.PluralRules; any category works)
data-label-all-one / -otherstring"Showing all {count} terms"Announcement when the filter is cleared
data-label-emptystring"No terms match your filter."Visible empty-state message
data-label-permalinkstring"Copy link to"Permalink name prefix (the term is appended)
data-label-copiedstring"Link copied to clipboard"Announcement after copying a term link

HTML Structure

The component expects a specific markup structure to enable progressive enhancement.

Required Classes

ClassElementPurpose
.glossary-jump nav Letter jump navigation bar
.glossary-section section Container for each letter group (must have an id matching the letter)

Content Elements

ElementPurpose
dl Definition list containing terms and descriptions
dt Term container
dfn The defined term (used as the search target)
dd Term definition

Behavior

  • Search filtering: A search input (in a <search> landmark) is injected at the top of an inner <main>, otherwise just before the .glossary-jump nav, otherwise after the first heading. Typing filters terms in real time, hiding non-matching terms and emptied sections. A visible message appears when nothing matches.
  • Term groups: Filtering walks real <dl> groups — several <dt> sharing one <dd>, several <dd> for one term, or <div>-wrapped groups — and hides or shows each group as a whole.
  • Scroll-spy: As the user scrolls, the active letter in the jump navigation gets aria-current="true" (styled bold in the interactive colour). The current letter is the last section whose top has passed a third of the way down the viewport, so the first letter is current at the top of the page however short its section is.
  • Arriving at a term: A link to a term’s id (from prose, or a related term) highlights the term and its definition as one tinted block with an accent on its leading edge, clear of a sticky header.
  • Permalinks (optional): With the permalinks attribute, every <dt> with an id gets a # link, shown on hover or focus. Activating it goes to the term (focus, history, :target) and copies the term’s URL to the clipboard. Jump links and permalinks stay on the page under <base href>.
  • Deep links: URL hash is updated when clicking jump links, allowing direct links to specific letters.
  • Progressive enhancement: Without JavaScript, the static markup provides a fully functional glossary with working anchor links.

Accessibility

  • Jump navigation uses aria-label="Jump to letter" for screen reader context
  • Active letter in jump navigation is marked with aria-current="true"
  • Search input has an accessible name from data-label-filter; the placeholder is only a hint
  • A polite status announces the match count while filtering, and the full count when the filter is cleared
  • Filtered-out sections are hidden with display: none, removing them from the accessibility tree; jump links to them are aria-disabled until the filter changes
  • Permalinks are named “Copy link to term”, are at least 24×24 px, show on hover, keyboard focus and always on touch devices, and announce when the link is copied
  • Uses semantic <dl>, <dt>, <dd>, and <dfn> elements
  • Keyboard accessible — tab through jump links and search input

Related

↑