Getting started
Accessibility
Accessibility is a test in the repository, not a promise in the docs.
The contrast gate#
The token test computes WCAG contrast for every text and background pair that the components use, in both themes and both brands. Translucent surfaces are composited over the canvas first. The build fails below 4.5:1 for text, and below 3:1 for large text and the focus ring.
| Pair | Minimum | Used for |
|---|---|---|
| text, muted, faint on canvas, surface, glass, raised | 4.5:1 | Body copy, secondary copy, captions |
| accent-text on canvas, surface, glass | 4.5:1 | Links, eyebrows, stat numbers |
| on-accent on accent-fill and accent-fill-hover | 4.5:1 | Primary buttons, active pills, badges |
| danger, success on canvas and surface | 4.5:1 | Status text |
| code tokens on code-bg | 4.5:1 | Syntax highlighting |
| hl-from, hl-to on canvas | 3:1 | Large gradient headings |
| focus-ring on canvas, surface, surface-2 | 3:1 | Keyboard focus outline |
The Tokens page recomputes these ratios in your browser, so you can see them change with the theme.
Built in behavior#
- Focus.
:focus-visibledraws a 2px outline from thefocus-ringtoken with a 3px offset. Interactive cards use:focus-within. - Reduced motion.
prefers-reduced-motion: reduceand the pause switch turn off CSS animation and transitions, show all revealed content, and stop particles. - Touch targets. Controls are at least 40px on desktop and 44px on phones.
- Text size. Body copy is 16px or more, labels are 13px or more at weight 500, and the article measure is 68ch.
- Skip link and landmarks.
.ha-skip-linkand.ha-visually-hiddenare in the base layer. - Native elements. Dialogs use
<dialog>, so focus trapping, Escape, and inertness of the page come from the browser.
Your part#
CSS cannot make a page accessible by itself. These are the things the markup has to do.
Do
- Use real
<button>and<a>elements for controls. - Keep one
<h1>per page and a logical heading order. - Give icon-only buttons an
aria-labelthat names the action. - Hide decorative glows and particles from assistive technology with
aria-hidden="true". - Set
aria-pressedon toggle buttons andaria-currenton the active item.
Don't
- Use
accentoraccent-lightas a text color. They are for decoration. - Put
fainton body copy. It is for captions and metadata. - Convey state by color alone.
- Autoplay moving content without a pause control placed at least 24px from what it controls.
- Remove the focus outline without replacing it.
Automated checks#
The repository runs axe-core through Playwright on the landing page and the documentation pages, in both themes, on every CI run. Axe catches roughly a third of issues. Keyboard and screen reader checks still matter.
npm run build:all
npm run a11y