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

short-cuts

Keyboard shortcuts help overlay. Press ? to see all bound shortcuts.

Description

The <short-cuts> component provides a keyboard shortcuts help overlay, similar to GitHub's ? shortcut or Gmail's shortcut reference. Place it once in your layout and press ? to see all currently bound keyboard shortcuts grouped by source.

Basic Usage

Drop <short-cuts> anywhere on the page. It renders nothing visible — it binds the ? hotkey and exposes show() for a visible button, so pointer and touch users can reach the list too. Press ? on this page to try it (it's already included in the layout).

Attributes

AttributeDefaultDescription
hotkeyshift+?Key combo that toggles the dialog. none turns the shortcut off. Changes are applied live.
data-label-titleKeyboard shortcutsDialog heading, which also names the dialog
data-label-generalGeneralGroup holding the component's own shortcut
data-label-selfShow keyboard shortcutsLabel of the component's own shortcut
data-label-closeCloseClose button name

Remapping or Turning Off ?

? is a single printable character, so under WCAG 2.1.4 (Character Key Shortcuts) users must be able to turn it off or remap it. They might be using speech input or a keyboard layout where ? is awkward. Set hotkey to a combo with a modifier, or to none, and give the dialog a visible button.

Users can also turn every single-character shortcut off at once with the Single-Key Shortcuts toggle in <settings-panel> (Accessibility), which sets <html data-char-shortcuts="off">. Authors can set that attribute in markup too. While it is off, ? no longer opens the dialog, and the dialog leaves out every unscoped character-key shortcut (its own ? and data-hotkey actions such as /), because none of them fire. Shortcuts with Ctrl, Cmd or Alt, and data-hotkey-scoped ones, are still listed.

JavaScript API

MemberTypeDescription
show()methodOpen the dialog, rebuilding the list from the current sources
close()methodClose the dialog
toggle()methodOpen when closed, close when open
openboolean (read-only)Whether the dialog is open
hotkeystring | null (read-only)Active combo, or null when hotkey="none"
shortcutsget/setOverride list { [group]: [{ label, shortcut }] }. When set, it replaces the registry sources (the component's own shortcut is still listed) and re-renders an open dialog. Set null to go back to the registries. Fires short-cuts:shortcuts-changed with { shortcuts, source }.

How It Works

When opened, the overlay reads two registries, unless the shortcuts property is set. The command registry (window.__commandRegistry) supplies registered commands that have a data-shortcut attribute, grouped by data-command-group. The hotkey-action registry supplies every non-<kbd> element with data-hotkey. It is labelled by data-hotkey-label (or its text) and grouped by data-hotkey-group, which defaults to "Page Actions".

Shortcut Sources

Source How it appears
[data-command][data-shortcut] elements Label from data-command, group from data-command-group
[data-hotkey] elements (not <kbd>) Label from data-hotkey-label or text, group from data-hotkey-group (default "Page Actions")
shortcuts property Replaces both registries while set
The component's own hotkey "Show keyboard shortcuts" in the "General" group (left out when hotkey="none")

Keyboard Support

Key Action
? (or the hotkey combo)Open/close the shortcuts overlay
EscapeClose the overlay

The hotkey does not fire when focus is inside an input, textarea, or content-editable element.

Accessibility

  • Opens as a modal <dialog> named by its heading (aria-labelledby), with a visible close button
  • Escape, the close button or a backdrop click closes it, and focus returns to where it was
  • Each group is a <section> with an <h3>, and rows form a <dl> (action in <dt>, keys in <dd>), so screen-reader users can jump between groups by heading
  • Key badges show platform glyphs (⌘, ⇧ on Mac; Ctrl, Shift elsewhere) and carry visually hidden spoken names ("Command K", "Shift ?")
  • The hotkey can be remapped or turned off (WCAG 2.1.4), and it honours the site-wide Single-Key Shortcuts preference (<html data-char-shortcuts="off">)
  • In forced-colors mode the dialog keeps a visible border
  • Native accesskey shortcuts are not read or listed; bind shortcuts with data-hotkey so they appear here
↑