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

site-map

Interactive HTML sitemap: a lightweight static-sitemap enhancer, or an information-architecture tree with page-type badges, keyboard navigation and an SVG org-chart view.

Overview

The <site-map> component has two modes. The default, mode="nav-enhance", enhances a static HTML sitemap with current-page highlighting, auto-expanding the section containing the current page, and expand/collapse all controls. mode="ia-tree" turns a nested list into an interactive information-architecture tree with page-type badges and an optional SVG org-chart view. Without JavaScript, either sitemap is a fully functional nested list of links.

Attributes

AttributeTypeDefaultDescription
current string window.location.pathname Pathname of the current page to highlight
mode string "nav-enhance" "nav-enhance" or "ia-tree" (see IA tree mode)
src string — URL to load sitemap data from as JSON. Strings render as text; only http(s), relative and fragment hrefs become link targets.
title string — [ia-tree] Heading and tree name
collapsed boolean — [ia-tree] Start with every node collapsed
compact boolean — [ia-tree] Tighter spacing
data-label-* string English [nav-enhance] UI string overrides: expand, collapse, controls
data-view string — [ia-tree] "visual" renders an SVG org chart
data-orientation string "vertical" [visual] "vertical" or "horizontal"
data-detail number 2 [visual] 0 shape, 1 title, 2 full, 3 full + status, 4 wireframe

Current Page Highlighting

By default, the component uses window.location.pathname to detect the current page and highlight its link. Use current to override this, for example in server-rendered or testing contexts.

The matching link receives an aria-current="page" attribute and a visual highlight. All ancestor <details> elements are automatically expanded to reveal it.

HTML Structure

The sitemap uses nested <details> and <summary> elements for collapsible sections, wrapped in a <nav> landmark.

Structure Rules

  • Wrap the entire sitemap in <nav aria-label="Full site map">
  • Use <details>/<summary> for sections with children
  • Place the section link inside <summary>
  • Child pages go in a nested <ul> inside the <details>
  • Leaf pages are simple <li><a> elements

Outline styling

The nav renders as a quiet outline: plain text links, a hairline down each nested level, and <details> branches that read as rows with a leading arrow. The expand/collapse-all buttons sit directly above it, below any heading and intro. Outside a <site-map>, add data-sitemap to the nav for the same styling.

Four optional hooks shape a large sitemap:

  • data-sitemap-section on a top-level <li> makes it a headed block: an <h2> followed by a <ul> whose items (the groups) sit side by side. A group that holds <details> takes the full row.
  • data-sitemap-leaves on a <ul> flows a long run of leaf pages into columns.
  • data-sitemap-label on a <span> labels a branch that has no page of its own. A <small> inside an <h2> or <summary> is a muted page count.
  • data-sitemap-updated on a <small> is a muted note of when a page, branch or section last changed.

This site's own sitemap is built this way, generated from the pages at build time.

JSON Data Loading

When src is set, the component fetches sitemap data from the specified URL and renders the tree dynamically, then adds the expand/collapse-all controls for it. Static markup serves as a fallback. In nav-enhance mode the JSON is { "children": [{ "title", "href", "children" }] }.

IA tree mode

mode="ia-tree" turns a nested <nav><ul><li><a> list into a tree for information-architecture work: each <li> can carry a page type, a template name and a status, shown as badges and a status dot. A header shows the page count, depth and an expand/collapse-all button.

Attribute on <li>Values
data-page-typelayout, section, dashboard, page (default), modal, redirect
data-templateAny template or view name, shown as an outlined badge
data-statusdraft, ready, live, deprecated — a coloured dot plus visually hidden text

Keyboard

The tree is a single Tab stop (roving tabindex, starting at the current page’s node or the first node); the links inside nodes leave the Tab order.

KeyAction
↓ / ↑Next / previous visible node
→Expand, or move to the first child (mirrored in right-to-left pages)
←Collapse, or move to the parent (mirrored in right-to-left pages)
EnterFollow the node’s link
SpaceExpand/collapse a parent; follow the link on a leaf
Home / EndFirst / last visible node

Visual (org chart) view

Add data-view="visual" for an SVG org chart with a group of controls for zoom, orientation and detail level. Each control is its own Tab stop. Re-renders swap only the chart, so a control keeps focus while you adjust it. Colours come from theme tokens (light, dark and forced colours).

The chart is a role="tree" SVG; each node is a treeitem with level, position and expanded state, and the active node is tracked with aria-activedescendant. Focus the chart, then: ↓ first child, ↑ parent, ← → previous and next sibling, Enter follows the node’s link (or collapses or expands a node that has no link), Space collapses or expands, Home/End first/last. The arrow keys follow the drawing. With data-orientation="horizontal" the root is on the left, children sit to the right of their parent and siblings run top to bottom: → first child, ← parent, ↑ ↓ previous and next sibling. The chart is not mirrored in right-to-left pages, so unlike the outline view its arrow keys are not reversed there. Enter sends site-map:select first; call preventDefault() on it to handle the node yourself and stop the navigation.

Data API

MemberDescription
pagesGet the tree as [{ label, href, pageType, template, status, children }], or assign one to rebuild it (fires site-map:pages-changed)
srcJSON { "title", "pages": [...] } in the same shape
site-map:ready{ nodeCount, depth } after the tree is built
site-map:select{ href, pageType, template } when a node is clicked, or when Enter is pressed on a linked node in the visual view (cancelable there)
site-map:pages-changed{ pages, source: 'property' } after assigning pages

Behavior

  • Auto-expand: The section containing the current page is automatically expanded on load.
  • Expand/collapse all: Control buttons are injected to expand or collapse all <details> sections at once.
  • Current page marking: The link matching the current pathname receives aria-current="page" and visual styling.
  • Progressive enhancement: Without JavaScript, the sitemap renders as a navigable nested list. Sections default to collapsed via <details>.

Accessibility

  • Uses <nav aria-label="Full site map"> for landmark navigation
  • Current page link is marked with aria-current="page"
  • nav-enhance: expand/collapse-all buttons are labelled by their text; <details>/<summary> provide native disclosure semantics; tab through links, Enter/Space toggles sections
  • ia-tree: the <nav> stays a navigation landmark and its root list becomes the role="tree", with treeitem/group inside, aria-expanded on parents, one Tab stop with arrow-key navigation (mirrored in RTL), Enter follows links, and status announced as text rather than colour alone
  • Forced-colors mode keeps badges, status dots and the visual chart visible with system colours
  • Without JavaScript, all content is accessible via native HTML disclosure widgets

Related

↑