Skip to content

Accessibility ​

The speaker's pages aim for WCAG 2.2 AA. They should work by keyboard alone, with a screen reader (VoiceOver, TalkBack, NVDA), with voice control, zoomed to 400 %, in Windows' forced colours, and with reduced motion. The Playwright specs check this on a desktop, a tablet and a phone; a change that breaks it fails them.

What the specs check ​

SpecChecks
a11y.spec.tsaxe (WCAG 2.2 AA and best practices) on every page in light and dark mode. Also: the login page, including after a failed login; the page that is not there; the player idle and with a playlist; the TV's account with view and full access; the form for choosing a password; a speaker that does not answer; the open dialogs (confirmation, playlist name, song picker); the phone's open menu; a pale accent the owner chose. It also checks that nothing moves with reduced motion, the skip link, one h1 per page, and that every setting has a description.
a11y-keyboard.spec.tsThe focus ring stands out at 3:1 or more in both modes and shows in forced colours. Focus stays on a switch, the mute button or a playlist's grip while the speaker answers, and moves to the next row or the list's heading when a song, a network or a folder goes away. The focused control is never under the volume bar. Field edges and switch tracks reach 3:1.
a11y-names.spec.tsOn every page, a control's spoken name contains the words it shows (2.5.3), and every slider says its value in words. Volume says "Muted". Countdowns and the live log do not speak every second. A refused field is aria-invalid and names its error. The song picker says what a search found.
layout.spec.tsNo sideways scrolling, touch targets of at least 44 × 44 px, and every page reflows to 320 px (1.4.10).
bash
ddev playwright test Tests/playwright/specs/a11y.spec.ts Tests/playwright/specs/a11y-keyboard.spec.ts Tests/playwright/specs/a11y-names.spec.ts Tests/playwright/specs/layout.spec.ts

The shared helpers are in Tests/playwright/support/a11y.ts:

  • violations(page) runs axe with the project's tags;
  • rendered(page) waits for the speaker's elements;
  • deepActive(page) names the focused element through shadow roots.

Patterns for new controls ​

Most of these live in controls.ts and SpeakerElement, so a new element gets them by using the helpers.

  • While waiting for the speaker, keep the focus. Use aria-disabled=${unavailable(this.busy)}, not ?disabled=${this.busy}. SpeakerElement swallows the clicks meanwhile. toggle() and askFirst() take { busy }. Keep disabled for controls that cannot be used for another reason, and say why in their description.
  • A control that goes away hands the focus on.
    • Use keepFocus(button, work) for a row's own action. askFirst() already does this.
    • Use focusHeading(this.renderRoot) after showing other content, such as a folder or the list after a detail view.
  • Every setting has a description: a <p class="hint" id="…"> and aria-describedby on the control.
  • No aria-label that drops the visible words. A label wrapping the control names it. Where an aria-label is needed, for example to leave out a value shown beside the label, it must contain the label's words. Buttons may add context after them: "Add to playlist: Song".
  • Sliders say their value: aria-valuetext. Use volumeText() for volumes, and spell out units ("300 milliseconds").
  • News goes into a region that is already there. Render <div class="live" role="status">${notice}</div> always and change only what is inside. An empty .live takes no room. Text that changes every second (countdowns, positions) stays out of live regions.
  • Errors about a field: the API answers with field, errorLine(field) shows the error, and SpeakerElement marks the field with that namearia-invalid and adds the error to its description.
  • Toggle buttons: a name that says the action ("Mute"/"Unmute"), or a fixed name with aria-pressed, never both.
  • Colours: text tokens reach 4.5:1 and edges of controls 3:1 (--boombox-control-border). An owner's accent is made readable by BrandTheme::readableAccent().

Checking by hand ​

The specs cannot hear a screen reader. Before a release, go through /, /playlists and /settings/audio with VoiceOver (⌘F5 on the Mac, or triple-click the side button on an iPhone):

  • play and pause;
  • change the volume;
  • move a song in a playlist with the keyboard;
  • delete a song and confirm.

Also press Tab through a page with the volume bar showing.