Accessibility
WCAG 2.2 AAA isn't a checklist bolted onto one screen; it's built into the design system. The patterns below are live: try them with a keyboard, and with a screen reader if you have one. Every example uses the same @foo/ui components as the rest of the app, and the whole project is checked automatically with axe in CI: the AAA + best-practice ruleset, every route in both themes, zero violations.
Skip link
The first thing in the tab order is a "Skip to main content" link (try pressing Tab right after a fresh load). It's visually hidden until focused, then jumps keyboard users past the sidebar straight to the page, so they don't tab through the whole navigation on every route.
View source: skip link, markup and styles
Two halves of one pattern: the link is the first thing in the shell's DOM so it's the first tab stop, and its target is the <main> the router fills. The styles pull it off-screen until :focus, then bring it back, visible only to the keyboard user who needs it.
<a class="skip-link" href="#main">Skip to main content</a>
<div class="shell">
<header class="shell__header">
<div class="shell__lead">
<!-- The hamburger lives at the head of the bar; it shows only ≤768px (see mobile-nav.scss). -->
<foo-mobile-nav />
<a class="brand" routerLink="/">
<img
class="brand__mark"
src="miguel-2026-brandmark.png"
alt=""
aria-hidden="true"
width="28"
height="28"
/>
<span class="brand__text">
<span class="brand__name">Enterprise Angular Showcase</span>
<span class="brand__by">by Miguel Carino</span>
</span>
</a>
<!-- Promoted from the bottom of /overview to a persistent header entry (one shared data source). -->
<foo-ecosystem-menu />
</div>
<div class="shell__actions">
<a class="companion" [href]="portfolioUrl" target="_blank" rel="noopener noreferrer">
A companion to <strong>miguelcarino.com</strong> <span aria-hidden="true">↗</span>
</a>
<label class="theme-switch">
<span class="theme-switch__label">Theme</span>
<!--
[selected] on each option, not [value] on the select: a native <select>'s value is
read before @for has rendered its options, so a [value] binding desyncs on reload:
the control shows Light while the page is the persisted theme. The option owns its own
selected state, so it lands correctly whatever order the DOM settles in.
-->
<select foo-select (change)="onThemeChange($event)">
@for (t of themes; track t) {
<option [value]="t" [selected]="t === theme.theme()">{{ t | titlecase }}</option>
}
</select>
</label>
</div>
</header>
<div class="shell__body">
<nav class="sidebar" aria-label="Sections">
@for (group of nav; track group.label) {
<div class="sidebar__group">
<h2 class="sidebar__group-title">{{ group.label }}</h2>
<ul class="sidebar__links">
@for (link of group.links; track link.path) {
<li>
<a
class="sidebar__link"
[routerLink]="'/' + link.path"
routerLinkActive="is-active"
[routerLinkActiveOptions]="{ exact: link.path === '' }"
>{{ link.label }}</a
>
</li>
}
</ul>
</div>
}
</nav>
<main id="main" class="content" tabindex="-1">
<router-outlet />
</main>
</div>
</div>
Focus management & trapping
The dialog is the native <dialog> element opened with showModal(), so the platform traps focus inside it, makes the background inert, and closes it on Escape. Open it, tab around (focus stays inside), then press Escape: focus returns to the button you opened it from.
View sourcedialog.ts
import {
ChangeDetectionStrategy,
Component,
effect,
ElementRef,
input,
model,
output,
viewChild,
} from '@angular/core';
import { Button } from '../button/button';
export type DialogSize = 'sm' | 'md' | 'lg';
let dialogId = 0;
/*
* A thin wrapper over the native `<dialog>` element. The whole point of this component is a
* refusal: I am not going to hand-roll a focus trap. Every modal library that does has the
* same bug list: Tab escapes to the page behind it, Escape doesn't close, the background
* stays clickable and screen-reader-readable, focus doesn't return to the trigger on close.
* `showModal()` solves all of that in the platform: it traps focus inside the dialog, wires
* Escape-to-close, marks the rest of the document inert, and exposes `aria-modal` semantics.
* The browser does this more correctly than userland JavaScript ever will, and it keeps doing
* it correctly as the spec evolves. So the job here shrinks to one honest task: keep an
* Angular signal in sync with whether the element is open. That's the only thing left to own.
*
* <foo-dialog [(open)]="confirmOpen" heading="Delete project" (closed)="onClosed()">
* Are you sure? This cannot be undone.
* <div dialogFooter>…actions…</div>
* </foo-dialog>
*
* `open` is a two-way `model`, which is the part that earns its keep: the host can both drive
* the dialog (set it true to open) and observe it (read it back when the user closes). The
* trap is forgetting the second direction. The user can close this dialog three ways I don't
* control (Escape, a click on the backdrop, the native `close()`), and if I only ever push
* the model down into the element, those closes leave the model stuck on `true`. So the
* binding has to be a loop: an `effect` reconciles the model into the element's real state,
* and the native `close` event reconciles back the other way. Honest in both directions.
*/
@Component({
selector: 'foo-dialog',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [Button],
template: `
<dialog
#dialog
class="foo-dialog"
closedby="any"
[attr.aria-labelledby]="headingId"
(close)="onNativeClose()"
>
<div class="foo-dialog__panel foo-dialog__panel--{{ dialogSize() }}">
<header class="foo-dialog__header">
<h2 class="foo-dialog__title" [id]="headingId">{{ heading() }}</h2>
<button
foo-button
variant="ghost"
size="sm"
class="foo-dialog__close"
aria-label="Close dialog"
(click)="close()"
>
×
</button>
</header>
<div class="foo-dialog__body">
<ng-content />
</div>
<footer class="foo-dialog__footer">
<ng-content select="[dialogFooter]" />
</footer>
</div>
</dialog>
`,
styleUrl: './dialog.scss',
})
export class Dialog {
readonly open = model(false);
readonly heading = input('');
readonly dialogSize = input<DialogSize>('md');
readonly closed = output<void>();
protected readonly headingId = `foo-dialog-title-${dialogId++}`;
private readonly dialogRef = viewChild.required<ElementRef<HTMLDialogElement>>('dialog');
constructor() {
/*
* Reconcile the model into the element. The guards on `el.open` are load-bearing:
* `showModal()` throws an InvalidStateError if the
* dialog is already open, and `close()` fires a redundant `close` event if it's already
* shut. Checking the element's own `open` flag before acting makes both calls idempotent,
* so this effect can re-run as often as the signal graph wants without side effects.
*/
effect(() => {
const el = this.dialogRef().nativeElement;
if (this.open()) {
if (!el.open) {
el.showModal();
}
} else if (el.open) {
el.close();
}
});
}
/*
* The close button doesn't touch the model. It calls the element's `close()` and stops
* there, because that fires the native `close` event, which `onNativeClose` already
* listens for. Every way of closing (button, Escape, backdrop) funnels through that one
* event, so the state-sync lives in exactly one place instead of being duplicated per path.
*/
protected close(): void {
this.dialogRef().nativeElement.close();
}
/*
* The single drain for every close. Whatever closed the dialog, the platform fires `close`
* and we land here: pull the model back to false (guarded so we don't loop with the effect)
* and emit `closed` for the host. This is the "reconcile back" half of the two-way loop.
*/
protected onNativeClose(): void {
if (this.open()) {
this.open.set(false);
}
this.closed.emit();
}
}
Mobile navigation drawer
Narrow the window below 768px and a hamburger appears in the header; it opens this app's own nav as a drawer. It's the focus-trap lesson above, applied: the drawer is a native <dialog> opened with showModal(), so the menu is its own exemplar. Open it and Tab, and focus stays inside. Press Escape and it closes and focus returns to the hamburger. The toggle carries aria-expanded/aria-controls, section groups start collapsed, and picking a link closes the drawer.
View source: the mobile nav drawermobile-nav.ts
The same refusal as the dialog: I won't hand-roll a focus trap when the platform has one. showModal() traps focus, makes the page inert, wires Escape and restores focus to the trigger, so the component only owns the two things it doesn't give for free, body-scroll lock and the aria-expanded state on the hamburger.
import {
ChangeDetectionStrategy,
Component,
ElementRef,
effect,
inject,
signal,
viewChild,
} from '@angular/core';
import { DOCUMENT, TitleCasePipe } from '@angular/common';
import { RouterLink, RouterLinkActive } from '@angular/router';
import type { Theme } from '@foo/tokens';
import { Select, ThemeService } from '@foo/ui';
import { NAV } from './navigation';
import { Ecosystem } from './ecosystem';
let drawerId = 0;
/*
* The mobile navigation drawer. On desktop the sidebar is always there; below 768px it would
* otherwise stack the whole catalog (15 links under eight headers) as a wall above the content.
* This replaces that with a hamburger in the header and a drawer holding the same nav.
*
* The a11y is the point: this is the accessibility showcase, so its own mobile menu has to be
* exemplary. Rather than hand-roll a focus trap (the same refusal as foo-dialog), the drawer is
* a native `<dialog>` opened with `showModal()`: the platform traps focus inside it, wires
* Escape-to-close, marks the rest of the document inert, exposes aria-modal, and returns focus
* to whatever was focused when it opened, which is the hamburger. The only things left to own are the
* two bits the platform doesn't give for free: body-scroll lock while open, and the aria-expanded
* state on the trigger. The toggle carries aria-expanded + aria-controls; section groups start
* collapsed (native <details>, so keyboard-operable for free); selecting a link closes the drawer.
*/
@Component({
selector: 'foo-mobile-nav',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [RouterLink, RouterLinkActive, Select, TitleCasePipe],
template: `
<button
#trigger
type="button"
class="mobile-nav__toggle"
[attr.aria-expanded]="open()"
[attr.aria-controls]="drawerElId"
aria-label="Navigation menu"
(click)="openDrawer()"
>
<span class="mobile-nav__bars" aria-hidden="true"></span>
</button>
<dialog
#drawer
[id]="drawerElId"
class="mobile-nav__drawer"
closedby="any"
aria-label="Sections"
(close)="onNativeClose()"
>
<div class="mobile-nav__panel">
<div class="mobile-nav__head">
<span class="mobile-nav__title">Sections</span>
<button
type="button"
class="mobile-nav__close"
aria-label="Close navigation menu"
(click)="close()"
>
<span aria-hidden="true">×</span>
</button>
</div>
<label class="mobile-nav__theme">
<span class="mobile-nav__theme-label">Theme</span>
<select foo-select (change)="onThemeChange($event)">
@for (t of themes; track t) {
<option [value]="t" [selected]="t === theme.theme()">{{ t | titlecase }}</option>
}
</select>
</label>
<nav class="mobile-nav__nav" aria-label="Sections menu">
@for (group of nav; track group.label) {
<details class="mobile-nav__group">
<summary class="mobile-nav__group-title">{{ group.label }}</summary>
<ul class="mobile-nav__links">
@for (link of group.links; track link.path) {
<li>
<a
class="mobile-nav__link"
[routerLink]="'/' + link.path"
routerLinkActive="is-active"
[routerLinkActiveOptions]="{ exact: link.path === '' }"
(click)="close()"
>{{ link.label }}</a
>
</li>
}
</ul>
</details>
}
</nav>
<div class="mobile-nav__ecosystem">
<span class="mobile-nav__section-title">Ecosystem</span>
<ul class="mobile-nav__links">
@for (item of ecosystem(); track item.href) {
<li>
<a
class="mobile-nav__link"
[href]="item.href"
target="_blank"
rel="noopener noreferrer"
(click)="close()"
>{{ item.label }} <span aria-hidden="true">↗</span></a
>
</li>
}
</ul>
</div>
</div>
</dialog>
`,
styleUrl: './mobile-nav.scss',
})
export class MobileNav {
private readonly document = inject(DOCUMENT);
protected readonly nav = NAV;
// The cross-surface links (federated host, remotes, Storybook, blog). The header's Ecosystem
// disclosure is squeezed off the bar on mobile, so the drawer carries them instead. Env-resolved
// (dev localhost / prod subdomains), SSR-safe; see the Ecosystem service.
protected readonly ecosystem = inject(Ecosystem).menu;
protected readonly theme = inject(ThemeService);
protected readonly themes = this.theme.available;
protected readonly open = signal(false);
protected readonly drawerElId = `mobile-nav-drawer-${drawerId++}`;
private readonly drawerRef = viewChild.required<ElementRef<HTMLDialogElement>>('drawer');
constructor() {
/*
* Reconcile the open signal into the element, and lock body scroll alongside. The guards on
* `el.open` are load-bearing, not padding: showModal() throws if the dialog is already open
* and close() fires a redundant close event if it's already shut. Checking the element's own
* flag first makes both idempotent, so the effect can re-run freely.
*/
effect(() => {
const el = this.drawerRef().nativeElement;
const body = this.document.body;
if (this.open()) {
if (!el.open) {
el.showModal();
}
// showModal() makes the page inert but doesn't stop it scrolling under the drawer.
body.style.overflow = 'hidden';
} else {
if (el.open) {
el.close();
}
body.style.overflow = '';
}
});
}
protected openDrawer(): void {
this.open.set(true);
}
protected onThemeChange(event: Event): void {
this.theme.setTheme((event.target as HTMLSelectElement).value as Theme);
}
// Close through the element so every path (button, Escape, backdrop) drains one close event.
protected close(): void {
this.drawerRef().nativeElement.close();
}
// The single drain. The platform returns focus to the trigger; we just sync the signal back.
protected onNativeClose(): void {
if (this.open()) {
this.open.set(false);
}
}
}
Live regions
Toasts render into an aria-live region, so a screen reader announces them without focus ever moving. Politeness follows severity: a success is polite, an error is assertive. Assertive asks to be read sooner; most screen readers still queue it rather than cutting in. Errors stay until you dismiss them, so nobody has to read one against a timer; a success clears itself after five seconds.
View source: the live-region toaster
The service is the only state: a signal queue with a timer per toast. The outlet reads that signal and renders the region; politeness is derived from the variant, so an error lands in the aria-live="assertive" region and a success in the polite one. The alerts inside render without their own role, so each message is announced once.
import { Injectable, signal } from '@angular/core';
import type { AlertVariant } from '../alert/alert';
export type ToastVariant = AlertVariant;
export interface Toast {
readonly id: number;
readonly variant: ToastVariant;
readonly heading?: string;
readonly message: string;
readonly duration: number;
}
// What a caller hands `show`; the id is assigned by the service.
export interface ToastInput {
readonly variant: ToastVariant;
readonly heading?: string;
readonly message: string;
// ms before the toast auto-dismisses; 0 keeps it until dismissed. Defaults by variant, below.
readonly duration?: number;
}
// Options for the convenience helpers; message is passed separately.
export type ToastOptions = Omit<ToastInput, 'variant' | 'message'>;
/*
* Confirmations clear themselves; problems don't. An error or warning the user has to read and
* act on shouldn't vanish against a clock (WCAG 2.2.1), so those stay until dismissed.
*/
function defaultDuration(variant: ToastVariant): number {
return variant === 'danger' || variant === 'warning' ? 0 : 5000;
}
/*
* Holds the queue of active toasts and owns their lifecycle. A toast is added by
* `show` (or a convenience helper), announced by the `foo-toaster` outlet, and removed
* either by its auto-dismiss timer or an explicit `dismiss(id)`. The signal is the only
* state; the outlet reads it and never mutates it.
*/
@Injectable({ providedIn: 'root' })
export class ToastService {
private readonly _toasts = signal<readonly Toast[]>([]);
readonly toasts = this._toasts.asReadonly();
private nextId = 0;
private readonly timers = new Map<number, ReturnType<typeof setTimeout>>();
// Queue a toast; returns its id. Auto-dismisses after `duration` ms, if that's above 0.
show(toast: ToastInput): number {
const id = this.nextId++;
const duration = toast.duration ?? defaultDuration(toast.variant);
const entry: Toast = {
id,
variant: toast.variant,
heading: toast.heading,
message: toast.message,
duration,
};
this._toasts.update((list) => [...list, entry]);
if (duration > 0) {
this.timers.set(
id,
setTimeout(() => this.dismiss(id), duration),
);
}
return id;
}
// Remove a toast and clear its pending timer.
dismiss(id: number): void {
const timer = this.timers.get(id);
if (timer !== undefined) {
clearTimeout(timer);
this.timers.delete(id);
}
this._toasts.update((list) => list.filter((t) => t.id !== id));
}
success(message: string, opts?: ToastOptions): number {
return this.show({ ...opts, variant: 'success', message });
}
info(message: string, opts?: ToastOptions): number {
return this.show({ ...opts, variant: 'info', message });
}
warning(message: string, opts?: ToastOptions): number {
return this.show({ ...opts, variant: 'warning', message });
}
danger(message: string, opts?: ToastOptions): number {
return this.show({ ...opts, variant: 'danger', message });
}
}
Keyboard navigation
Composite widgets follow the WAI-ARIA authoring practices: one tab stop, then arrow keys move within. Focus the tabs and press ←/→; open the menu and use ↑/↓, Home/End, and Escape.
Arrow keys move between tabs (with wraparound); focus follows selection, and only the active tab is in the page tab order (roving tabindex).
The button owns aria-haspopup/aria-expanded; the list is a role="menu" with roving tabindex. Selecting returns focus to the trigger.
Every control is a real native element with a programmatic label, an aria-describedby hint/error, and aria-invalid on failure.
View sourcetabs.ts
import {
ChangeDetectionStrategy,
Component,
ElementRef,
computed,
contentChildren,
effect,
model,
viewChildren,
} from '@angular/core';
import { Tab } from './tab';
/*
* A WAI-ARIA tabs widget. The children (projected `foo-tab` elements) are read with
* `contentChildren`, and from them we render a `role=tablist` of `role=tab` buttons above the
* projected panels. Selection lives in a two-way `selectedIndex` model so a parent can drive
* or observe the active tab.
*
* The keyboard model is the part most homegrown tab strips get wrong, and it's worth slowing
* down on. A naive implementation gives every tab `tabindex="0"`, which means Tab stops on
* each one: eight tabs become eight stops a keyboard user has to walk past to reach the
* panel. The ARIA pattern is the opposite: the tablist is ONE tab stop. Exactly one tab holds
* `tabindex="0"` (the active one); the rest hold `-1`, which keeps them focusable by script
* but skips them in the Tab order. That's "roving tabindex": the single 0 roves to whichever
* tab is active. Tab moves you past the whole group; the arrow keys move you within it. You
* can see the roving directly in the template: `[tabindex]="i === activeIndex() ? 0 : -1"`.
*
* This is the "automatic activation" flavor of the pattern: arrows move selection (with
* wraparound), Home/End jump to the ends, and focus follows selection so the panel under the
* focused tab is the one that shows. The alternative, manual activation (arrows only
* move focus and you press Enter to select), is the right call when switching tabs is
* expensive (a network fetch per panel). These panels are already projected, so automatic is
* the friendlier choice.
*/
@Component({
selector: 'foo-tabs',
changeDetection: ChangeDetectionStrategy.OnPush,
/*
* No `imports: [Tab]` here on purpose. `Tab` is used as a query token for contentChildren,
* not as a tag this template renders, so it isn't a template dependency. Listing it would
* compile clean but mislead the next reader into thinking we render `<foo-tab>` ourselves.
*/
template: `
<div class="foo-tabs__list" role="tablist">
@for (tab of tabs(); track tab.tabId; let i = $index) {
<button
#tabButton
class="foo-tabs__tab"
type="button"
role="tab"
[id]="tab.tabId"
[attr.aria-controls]="tab.panelId"
[attr.aria-selected]="i === activeIndex()"
[class.foo-tabs__tab--active]="i === activeIndex()"
[tabindex]="i === activeIndex() ? 0 : -1"
(click)="select(i)"
(keydown)="onKeydown($event)"
>
{{ tab.label() }}
</button>
}
</div>
<div class="foo-tabs__panels">
<ng-content />
</div>
`,
styleUrl: './tabs.scss',
})
export class Tabs {
readonly tabs = contentChildren(Tab);
readonly selectedIndex = model(0);
private readonly tabButtons = viewChildren<ElementRef<HTMLButtonElement>>('tabButton');
/*
* `selectedIndex` is host-controlled, so I can't trust it to be in range: a parent can
* set it to 9 when there are three tabs, or a tab can be removed out from under a stale
* value. `activeIndex` is the clamped, always-valid truth the template renders from, while
* `selectedIndex` stays the raw model the host owns. Deriving one from the other keeps the
* invalid state from ever reaching the DOM instead of guarding for it at every read site.
*/
protected readonly activeIndex = computed(() => {
const count = this.tabs().length;
if (count === 0) {
return 0;
}
return Math.min(Math.max(this.selectedIndex(), 0), count - 1);
});
constructor() {
/*
* The panels need to know which one of them is showing, but a projected `foo-tab` has no
* idea where it sits in the list. It's just content, passive by design. So selection is
* owned here and pushed down: whenever the active index or the set of tabs changes, this
* effect flips each child's `active` flag. One source of truth at the top, children that
* only ever react. That's deliberately the inverse of letting each panel manage itself,
* which is how two tabs end up both thinking they're visible.
*/
effect(() => {
const active = this.activeIndex();
this.tabs().forEach((tab, i) => tab.active.set(i === active));
});
}
protected select(index: number): void {
if (index !== this.selectedIndex()) {
this.selectedIndex.set(index);
}
}
protected onKeydown(event: KeyboardEvent): void {
/*
* The wraparound is the whole point of the modulo. ArrowRight off the last tab lands on
* the first; ArrowLeft off the first wraps to the last. `(current - 1 + count) % count`
* adds `count` first so the index never goes negative before the modulo. A keyboard user
* should never hit a dead end at either end of the strip. The handler is only ever bound
* on rendered tab buttons, so `count` is guaranteed > 0 here and the modulo is safe.
*/
const count = this.tabs().length;
const current = this.activeIndex();
let next: number | null = null;
switch (event.key) {
case 'ArrowRight':
next = (current + 1) % count;
break;
case 'ArrowLeft':
next = (current - 1 + count) % count;
break;
case 'Home':
next = 0;
break;
case 'End':
next = count - 1;
break;
default:
return;
}
event.preventDefault();
this.select(next);
this.focusTab(next);
}
/*
* Selecting a tab updates the model, but the model doesn't move DOM focus, and with roving
* tabindex it has to. The newly active tab is now the only one with `tabindex="0"`; the tab
* the user was just on dropped to `-1`. If I don't explicitly move focus onto the new tab,
* focus is left sitting on an element that's now skipped in the Tab order, and the next Tab
* press jumps somewhere unexpected. So arrow navigation always pairs select() with focusTab().
*/
private focusTab(index: number): void {
// focus() scrolls the element into view in most engines, but when the tablist is its own
// horizontal scroller (the mobile strip) a programmatic focus can leave the tab clipped at an
// edge. The explicit scrollIntoView keeps arrow navigation reaching tabs that started offscreen.
const button = this.tabButtons()[index]?.nativeElement;
button?.focus();
button?.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });
}
}
Built into the tokens
View source: the a11y defaults in the reset_reset.scss
These guarantees aren't sprinkled per component. They live once in the token reset. :focus-visible draws the ring from a single --foo-color-focus token so every surface focuses identically, and the prefers-reduced-motion block collapses animation app-wide for users who asked the OS to calm motion down.
/*
* A small, opinionated reset. Just enough to make the token system the baseline:
* box-sizing, sane margins, themed body and accessibility defaults that are easy to
* forget (focus-visible, reduced motion, readable line length on text).
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
* {
margin: 0;
}
html {
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
}
body {
min-height: 100vh;
font-family: var(--foo-font-sans);
font-size: var(--foo-text-base);
line-height: var(--foo-leading-normal);
color: var(--foo-color-text);
background-color: var(--foo-color-bg);
-webkit-font-smoothing: antialiased;
}
/*
* Keyboard users get a ring; pointer users don't. The ring itself is a token so every
* surface focuses the same way.
*/
:focus-visible {
outline: 2px solid var(--foo-color-focus);
outline-offset: 2px;
}
img,
picture,
svg,
video {
display: block;
max-width: 100%;
}
input,
button,
textarea,
select {
font: inherit;
color: inherit;
}
// Respect the user. If they've asked the OS to calm motion down, we listen.
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
A 4.37:1 badge
The first time this project's axe sweep ran, it failed. The danger badge set its text in the danger hue, #b44835, on a 12% tint of that same hue, and axe measured 4.37:1. WCAG AA asks 4.5:1 of text that size, so the badge missed by a hair. The same pair turned up again in the error text of a :has() demo (4.37:1), and brand-coloured text on a pale surface measured 4.41:1. Each fix moved the words to a deeper shade and left fills and borders on the saturated hue. That split became a rule in the tokens: every status colour has a -text shade for words, and when this site raised its bar to AAA, those shades were darkened again to clear 7:1 on plain surfaces and on their own tint.
Both pairs below are measured in your browser from the colours it painted, in whichever theme is active; switch the theme in the header and the numbers follow. The light theme's cards sit on the same paper surface the sweep measured against, #fffaf3, so in light the old pair reads 4.37:1 again. The "before" sample is drawn as bars rather than words, because this page runs through the same sweep with nothing excluded.
Before: the danger hue as text
--foo-color-danger on --foo-color-danger-bg
Measured in the browser once the page has rendered.
After: the badge as it ships
--foo-color-danger-text on --foo-color-danger-bg
Measured in the browser once the page has rendered.
View source: the live contrast readout
The component reads getComputedStyle from the painted sample and from the real badge, and contrast.ts turns those colours into the WCAG ratio: relative luminance of each, then (lighter + 0.05) / (darker + 0.05). The spec pins the arithmetic to known pairs, including the 4.37:1 the sweep caught. badge.scss is where the fix lives.
import {
ChangeDetectionStrategy,
Component,
ElementRef,
afterRenderEffect,
inject,
signal,
viewChild,
} from '@angular/core';
import { NgTemplateOutlet } from '@angular/common';
import { Badge, ThemeService } from '@foo/ui';
import { contrastRatio, formatRatio, meets, parseColor, toHex } from './contrast';
interface Reading {
readonly text: string;
readonly background: string;
readonly ratio: number;
}
/*
* The danger badge before and after the fix, measured from what the browser painted. The
* "before" pair is drawn as bars, not words: this page runs through the same axe sweep with no
* exclusions, so it can't ship the very text failure it describes. The "after" is the real
* badge, so its numbers are the design system's, not a copy of them.
*/
@Component({
selector: 'foo-contrast-catch',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [Badge, NgTemplateOutlet],
template: `
<div class="pairs">
<figure class="pair" data-pair="before">
<div class="swatch" #beforeBg aria-hidden="true">
<span class="swatch__line" #beforeFg></span>
<span class="swatch__line swatch__line--short"></span>
</div>
<figcaption>
<p class="pair__title">Before: the danger hue as text</p>
<p class="pair__tokens">
<code>--foo-color-danger</code> on <code>--foo-color-danger-bg</code>
</p>
<ng-container *ngTemplateOutlet="readout; context: { $implicit: before() }" />
</figcaption>
</figure>
<figure class="pair" data-pair="after">
<div class="swatch swatch--live">
<foo-badge variant="danger" #afterBadge>Overdue</foo-badge>
</div>
<figcaption>
<p class="pair__title">After: the badge as it ships</p>
<p class="pair__tokens">
<code>--foo-color-danger-text</code> on <code>--foo-color-danger-bg</code>
</p>
<ng-container *ngTemplateOutlet="readout; context: { $implicit: after() }" />
</figcaption>
</figure>
</div>
<ng-template #readout let-reading>
@if (reading) {
<dl class="readout">
<dt>Text</dt>
<dd>
<code data-text>{{ reading.text }}</code>
</dd>
<dt>Background</dt>
<dd>
<code data-background>{{ reading.background }}</code>
</dd>
<dt>Contrast</dt>
<dd>
<strong data-ratio>{{ format(reading.ratio) }}</strong>
</dd>
<dt>AA (4.5:1)</dt>
<dd data-aa>{{ meets(reading.ratio, 4.5) ? 'Pass' : 'Fail' }}</dd>
<dt>AAA (7:1)</dt>
<dd data-aaa>{{ meets(reading.ratio, 7) ? 'Pass' : 'Fail' }}</dd>
</dl>
} @else {
<p class="readout__pending">Measured in the browser once the page has rendered.</p>
}
</ng-template>
`,
styleUrl: './contrast-catch.scss',
})
export class ContrastCatch {
private readonly theme = inject(ThemeService);
private readonly beforeFg = viewChild.required<ElementRef<HTMLElement>>('beforeFg');
private readonly beforeBg = viewChild.required<ElementRef<HTMLElement>>('beforeBg');
private readonly afterBadge = viewChild.required(Badge, { read: ElementRef });
protected readonly before = signal<Reading | null>(null);
protected readonly after = signal<Reading | null>(null);
protected readonly format = formatRatio;
protected readonly meets = meets;
constructor() {
// Reading the theme signal here re-runs the measurement after each switch has painted.
afterRenderEffect({
read: () => {
this.theme.theme();
const badge = getComputedStyle(this.afterBadge().nativeElement);
this.before.set(
measure(
getComputedStyle(this.beforeFg().nativeElement).backgroundColor,
getComputedStyle(this.beforeBg().nativeElement).backgroundColor,
),
);
this.after.set(measure(badge.color, badge.backgroundColor));
},
});
}
}
function measure(text: string, background: string): Reading | null {
try {
const fg = parseColor(text);
const bg = parseColor(background);
return { text: toHex(fg), background: toHex(bg), ratio: contrastRatio(fg, bg) };
} catch {
// An engine that serialises in another colour space gets no numbers rather than wrong ones.
return null;
}
}
What WCAG 2.2 added
WCAG 2.2 added nine success criteria and removed one, 4.1.1 Parsing. Where this demo can show a new criterion working, it does, just below; where it can't, the table says so.
| Criterion | Level | On this page |
|---|---|---|
| 2.4.11 Focus Not Obscured (Minimum) | AA | Fixed app-wide |
| 2.4.12 Focus Not Obscured (Enhanced) | AAA | Same fix |
| 2.4.13 Focus Appearance | AAA | Not measured here; the focus ring comes from the tokens |
| 2.5.7 Dragging Movements | AA | Reorder by button |
| 2.5.8 Target Size (Minimum) | AA | Measured targets |
| 3.2.6 Consistent Help | A | No help mechanism to apply it to |
| 3.3.7 Redundant Entry | A | Shipping same as billing |
| 3.3.8 Accessible Authentication (Minimum) | AA | Sign-in that allows paste and autofill |
| 3.3.9 Accessible Authentication (Enhanced) | AAA | Same form |
2.4.11 Focus Not Obscured (Minimum)
This app's header is sticky: it stays put while the page scrolls under it. A browser scrolls a newly focused control into view only when it's outside the viewport, and a control under a sticky header is inside it. So pressing Shift+Tab back up a scrolled page could land focus on something the header covered completely. The fix is one line of CSS on the root scroller, scroll-padding-top, which tells the browser the top strip is taken. Focus scrolling then stops below the header, with room left for the focus ring, so the focused control stays fully in sight: the stricter bar of 2.4.12 (AAA).
View source: the app-wide scroll paddingstyles.scss
The rule is the html block at the top. It's in the global stylesheet, not the shell's component styles, because the element that scrolls is the document itself.
/* Global app styles. The token theme is loaded ahead of this file via the build's
styles array, so everything here can lean on --foo-* custom properties. These are the
shared page primitives every demo page reuses; component-specific styling stays in
each component's own scoped stylesheet. */
/* WCAG 2.2, 2.4.11 Focus Not Obscured. The shell header is sticky, so a control the browser
counts as "in view" can sit entirely under it. scroll-padding tells the root scroller that
the top strip is covered, so scrolling a focused control into view stops below the header.
The header is 65 to 80px tall depending on width (80 where its text wraps), so 6rem clears
the tallest with room for the focus ring. The a11y-wcag22 e2e fails if the header outgrows it. */
html {
scroll-padding-top: 6rem;
}
.page-head {
max-width: 60rem;
margin-bottom: var(--foo-space-6);
}
.page-head__title {
margin: 0 0 var(--foo-space-3);
font-size: var(--foo-text-2xl);
font-weight: var(--foo-weight-bold);
color: var(--foo-color-text);
}
.page-head__lead {
margin: 0;
font-size: var(--foo-text-lg);
line-height: var(--foo-leading-normal);
color: var(--foo-color-text-muted);
}
/* Inline prose links: the AAA brand-text shade (7:1 every theme) + underline, so they're
unmistakably links and never fall back to the UA default (which misses 7:1 in dark). The
nav/button anchors set their own colour and override this. */
a {
color: var(--foo-color-brand-text);
&:hover {
color: var(--foo-color-brand-hover);
}
}
/* Inline technical terms in prose render as a tinted mono "chip", clearly NOT a link.
Links stay brand-coloured / underlined; this reads as ink-on-tint so the two never blur.
Only inline <code> gets the chip: syntax-highlighted blocks (<pre><code>) and the
source-viewer reset below, so they keep their own panel treatment. */
code {
font-family: var(--foo-font-mono);
font-size: 0.9em;
padding: 0.1em var(--foo-space-1);
background: var(--foo-color-surface-sunken);
border: 1px solid var(--foo-color-border);
border-radius: var(--foo-radius-sm);
color: var(--foo-color-text);
}
/* Block code is panel-framed elsewhere: strip the chip so it never doubles up. */
pre code,
.foo-source code {
padding: 0;
background: none;
border: 0;
border-radius: 0;
font-size: inherit;
}
/* A labelled region most demos use to frame an interactive example. */
.demo-panel {
margin-top: var(--foo-space-5);
padding: var(--foo-space-5);
background: var(--foo-color-surface);
border: 1px solid var(--foo-color-border);
border-radius: var(--foo-radius-lg);
}
.demo-panel__title {
margin: 0 0 var(--foo-space-4);
font-size: var(--foo-text-lg);
font-weight: var(--foo-weight-semibold);
color: var(--foo-color-text);
}
/* Inline code reads as one unbreakable word, so a long call such as
provideClientHydration(withEventReplay(), ...) would push a phone-width page sideways. Code
blocks keep their own horizontal scroll. */
:not(pre) > code {
overflow-wrap: anywhere;
}
2.5.8 Target Size (Minimum)
A pointer target has to be at least 24 by 24 CSS pixels, unless an exception applies (enough space around it, an equivalent control that size, or a link inside a sentence). These are the design system's smallest buttons, measured live below. The axe sweep checks this on every route and theme: its target-size rule runs under the wcag22aa tag. The AAA version, 2.5.5 Target Size (Enhanced) at 44 by 44, dates from WCAG 2.1, and axe doesn't test it.
View source: measuring the targetstarget-sizes.ts
import {
ChangeDetectionStrategy,
Component,
ElementRef,
afterRenderEffect,
signal,
viewChildren,
} from '@angular/core';
import { Button } from '@foo/ui';
interface Measured {
readonly label: string;
readonly width: number;
readonly height: number;
}
/*
* 2.5.8 Target Size (Minimum): the design system's smallest button, in the tightest place it
* gets used, a row of page-size choices. Sizes are read from the rendered boxes, so the numbers
* are what a pointer actually has to hit at the current zoom and font size.
*/
@Component({
selector: 'foo-target-sizes',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [Button],
template: `
<div class="sizes" role="group" aria-label="Rows per page">
@for (n of options; track n) {
<button
#target
foo-button
size="sm"
[variant]="n === selected() ? 'primary' : 'secondary'"
[attr.aria-pressed]="n === selected()"
(click)="selected.set(n)"
>
{{ n }}
</button>
}
</div>
<ul class="measured">
@for (m of measured(); track m.label) {
<li [attr.data-target]="m.label">"{{ m.label }}": {{ m.width }} × {{ m.height }} px</li>
}
</ul>
`,
styleUrl: './target-sizes.scss',
})
export class TargetSizes {
protected readonly options = [10, 25, 50, 100];
protected readonly selected = signal(25);
// read: ElementRef, or the ref resolves to the Button component on that element.
private readonly targets = viewChildren('target', { read: ElementRef<HTMLButtonElement> });
protected readonly measured = signal<readonly Measured[]>([]);
constructor() {
afterRenderEffect({
read: () => {
// The pressed variant could change a border width, so re-measure on every selection.
this.selected();
this.measured.set(
this.targets().map(({ nativeElement: el }: ElementRef<HTMLButtonElement>) => {
const box = el.getBoundingClientRect();
return {
label: el.textContent?.trim() ?? '',
width: Math.round(box.width),
height: Math.round(box.height),
};
}),
);
},
});
}
}
2.5.7 Dragging Movements
Anything a drag can do needs a single-pointer way that doesn't drag. Drag a row by its handle, or use its Up and Down buttons, which also work from the keyboard. Each move is announced through a status message.
- Billing
- Payroll
- Reporting
- Audit
View source: reorder by drag or by buttonreorder-list.ts
import {
ChangeDetectionStrategy,
Component,
ElementRef,
Injector,
afterNextRender,
inject,
signal,
} from '@angular/core';
import {
CdkDrag,
CdkDragHandle,
type CdkDragDrop,
CdkDropList,
moveItemInArray,
} from '@angular/cdk/drag-drop';
import { Button } from '@foo/ui';
/*
* 2.5.7 Dragging Movements: drag is offered, never required. Every reorder a drag can make, the
* two buttons on each row can make with single clicks or the keyboard, and the result is
* announced through a polite status so a screen reader hears where the item landed.
*/
@Component({
selector: 'foo-reorder-list',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [CdkDropList, CdkDrag, CdkDragHandle, Button],
template: `
<ol class="reorder" cdkDropList aria-label="Priorities" (cdkDropListDropped)="dropped($event)">
@for (item of items(); track item; let i = $index, first = $first, last = $last) {
<li class="reorder__item" cdkDrag [attr.data-item]="item">
<span class="reorder__handle" cdkDragHandle aria-hidden="true">⠿</span>
<span class="reorder__label">{{ item }}</span>
<span class="reorder__moves">
<button
foo-button
variant="secondary"
size="sm"
data-move="up"
[disabled]="first"
[attr.aria-label]="'Move ' + item + ' up'"
(click)="move(i, -1)"
>
Up
</button>
<button
foo-button
variant="secondary"
size="sm"
data-move="down"
[disabled]="last"
[attr.aria-label]="'Move ' + item + ' down'"
(click)="move(i, 1)"
>
Down
</button>
</span>
</li>
}
</ol>
<p class="reorder__status" role="status">{{ status() }}</p>
`,
styleUrl: './reorder-list.scss',
})
export class ReorderList {
private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);
private readonly injector = inject(Injector);
readonly items = signal(['Billing', 'Payroll', 'Reporting', 'Audit']);
protected readonly status = signal('');
protected dropped(event: CdkDragDrop<unknown>): void {
this.reorder(event.previousIndex, event.currentIndex);
}
protected move(index: number, by: -1 | 1): void {
const item = this.items()[index];
this.reorder(index, index + by);
// The row's DOM node moves, which drops focus; put it back on a move button for the same
// item, the other one if this one just became disabled at the end of the list.
afterNextRender(
() => {
const row = this.host.nativeElement.querySelector(`[data-item="${item}"]`);
const wanted = row?.querySelector<HTMLButtonElement>(
`[data-move="${by < 0 ? 'up' : 'down'}"]`,
);
const other = row?.querySelector<HTMLButtonElement>(
`[data-move="${by < 0 ? 'down' : 'up'}"]`,
);
(wanted && !wanted.disabled ? wanted : other)?.focus();
},
{ injector: this.injector },
);
}
private reorder(from: number, to: number): void {
if (from === to) return;
const next = [...this.items()];
moveItemInArray(next, from, to);
this.items.set(next);
this.status.set(`${next[to]} moved to position ${to + 1} of ${next.length}.`);
}
}
3.3.7 Redundant Entry
Information a person already gave in the same process has to be filled in for them or offered to pick. Type a billing address, then tick the box: the shipping fields fill from it and stay in step until you untick it.
View source: shipping same as billingsame-as-billing.ts
import { ChangeDetectionStrategy, Component, computed, signal } from '@angular/core';
import { Checkbox, FormField, Input } from '@foo/ui';
interface Address {
readonly street: string;
readonly city: string;
readonly postcode: string;
}
const BLANK: Address = { street: '', city: '', postcode: '' };
type Field = keyof Address;
/*
* 3.3.7 Redundant Entry: the shipping address was already typed once, as the billing address,
* so one checkbox fills it in. While it's ticked the shipping fields follow billing and are
* read-only; untick it and they become editable, starting from what was copied.
*/
@Component({
selector: 'foo-same-as-billing',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [FormField, Input, Checkbox],
template: `
<fieldset class="address">
<legend>Billing address</legend>
@for (f of fields; track f.key) {
<foo-form-field [label]="f.label" [controlId]="'bill-' + f.key">
<input
foo-input
type="text"
[id]="'bill-' + f.key"
[attr.autocomplete]="'billing ' + f.autocomplete"
[value]="billing()[f.key]"
(input)="setBilling(f.key, $event)"
/>
</foo-form-field>
}
</fieldset>
<label class="same">
<input
type="checkbox"
foo-checkbox
[checked]="sameAsBilling()"
(change)="toggleSame($event)"
/>
Shipping address is the same as billing
</label>
<fieldset class="address">
<legend>Shipping address</legend>
@for (f of fields; track f.key) {
<foo-form-field [label]="f.label" [controlId]="'ship-' + f.key">
<input
foo-input
type="text"
[id]="'ship-' + f.key"
[attr.autocomplete]="'shipping ' + f.autocomplete"
[readOnly]="sameAsBilling()"
[value]="shippingShown()[f.key]"
(input)="setShipping(f.key, $event)"
/>
</foo-form-field>
}
</fieldset>
`,
styleUrl: './same-as-billing.scss',
})
export class SameAsBilling {
protected readonly fields: readonly { key: Field; label: string; autocomplete: string }[] = [
{ key: 'street', label: 'Street', autocomplete: 'street-address' },
{ key: 'city', label: 'City', autocomplete: 'address-level2' },
{ key: 'postcode', label: 'Postal code', autocomplete: 'postal-code' },
];
readonly billing = signal<Address>(BLANK);
readonly sameAsBilling = signal(false);
private readonly shipping = signal<Address>(BLANK);
readonly shippingShown = computed(() =>
this.sameAsBilling() ? this.billing() : this.shipping(),
);
protected setBilling(key: Field, event: Event): void {
this.billing.update((a) => ({ ...a, [key]: (event.target as HTMLInputElement).value }));
}
protected setShipping(key: Field, event: Event): void {
this.shipping.update((a) => ({ ...a, [key]: (event.target as HTMLInputElement).value }));
}
protected toggleSame(event: Event): void {
const same = (event.target as HTMLInputElement).checked;
// Unticking keeps the copy, so a small edit doesn't mean retyping the whole address.
if (!same) this.shipping.set(this.billing());
this.sameAsBilling.set(same);
}
}
3.3.8 Accessible Authentication (Minimum)
Remembering a password counts as a cognitive function test, so sign-in has to let something else do the remembering. This form doesn't block paste, and its autocomplete tokens (username, current-password) let a browser or password manager fill it. It asks for no puzzle or picture choice, so it also meets 3.3.9 (Enhanced, AAA). It signs nobody in.
View source: a sign-in that allows helpsign-in-fields.ts
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { Button, FormField, Input } from '@foo/ui';
/*
* 3.3.8 Accessible Authentication (Minimum): remembering a password is a cognitive function test,
* so the form has to let something else do the remembering. Two things make that work, and both
* are things this form leaves alone: paste is never blocked, and the autocomplete tokens tell a
* browser or password manager exactly which field is which, so it can fill them.
*
* Nothing is sent anywhere; submitting only confirms the fields were filled.
*/
@Component({
selector: 'foo-sign-in-fields',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [FormField, Input, Button],
template: `
<form
class="sign-in"
aria-label="Demo sign-in"
toolname="demo_sign_in_fields"
tooldescription="Demo only: sign-in fields that allow paste and password managers (WCAG 2.2 Accessible Authentication). Submitting sends nothing."
(submit)="submit($event)"
>
<foo-form-field label="Email" controlId="auth-email">
<input id="auth-email" foo-input type="email" name="email" autocomplete="username" />
</foo-form-field>
<foo-form-field label="Password" controlId="auth-password">
<input
id="auth-password"
foo-input
type="password"
name="password"
autocomplete="current-password"
/>
</foo-form-field>
<button foo-button type="submit">Sign in</button>
<p class="sign-in__status" role="status">{{ status() }}</p>
</form>
`,
styleUrl: './sign-in-fields.scss',
})
export class SignInFields {
protected readonly status = signal('');
protected submit(event: Event): void {
event.preventDefault();
const data = new FormData(event.target as HTMLFormElement);
const filled = Boolean(data.get('email')) && Boolean(data.get('password'));
this.status.set(
filled ? 'Both fields filled. This demo signs nobody in.' : 'Fill both fields first.',
);
}
}
3.2.6 Consistent Help
When a site repeats a help mechanism across pages (contact details, a contact form, a chat, a help page), it has to appear in the same order relative to the rest of the page each time. This demo has none, so the criterion has nothing to apply to. If one were added, it would go in the app shell, which renders once around every route, so it would keep its place by construction.
Screen-reader testing
The axe sweep checks what the markup says: names, roles and states. It can't check what a screen reader says, and neither can any other automated test. These are the checks to run by hand with JAWS or NVDA on Windows, or VoiceOver on a Mac or iPhone. Exact wording differs between readers, browsers and verbosity settings, so listen for the information, not the phrasing.
| Pattern | Try this | Expect |
|---|---|---|
| Skip link | Load any page, press Tab once, then Enter. | A link named "Skip to main content" is read first; after Enter, reading continues from the page heading, not the sidebar. |
| Modal dialog | Activate "Open dialog", Tab through it, then press Escape. | A dialog named "Confirm transfer" is announced on open. Tab stays inside it, and the virtual cursor cannot reach the page behind. Escape closes it and focus lands back on "Open dialog". |
| Live regions | Activate "Announce success", then "Announce error". | Each message is read once without focus moving. The error is assertive, so it may be read sooner, but many readers still finish the current phrase first. |
| Tabs and menu | Tab to the tabs and use the arrow keys; then open "Row actions" and arrow through it. | Each tab is read with its role, name, position (for example "2 of 3") and selected state. The menu button reports collapsed or expanded; the disabled "Archive" item is read as unavailable. |
| Form errors | Tab into "Full name", leave it empty and Tab away, then Tab back. | The error "Full name is required." is announced when it appears. Back on the field, it is read as invalid, with the error as its description. |
| Reorder without dragging | Use a "Move up" or "Move down" button in the priorities list. | The new position is announced (for example "Billing moved to position 1 of 4"), and focus stays on a move button for the same item. |
View source: the screen-reader checklistscreen-reader-targets.ts
/*
* What to try with JAWS, NVDA or VoiceOver, and what should happen. These are checks for a
* person to run: wording differs by screen reader, browser and verbosity setting, and no
* automated test can assert speech. The axe sweep covers the static half (names, roles,
* states in the markup); this list covers what only listening can confirm.
*/
export interface ScreenReaderTarget {
readonly pattern: string;
// A route-relative link to the live example.
readonly path: string;
readonly fragment: string;
readonly tryThis: string;
readonly expect: string;
}
export const SCREEN_READER_TARGETS: readonly ScreenReaderTarget[] = [
{
pattern: 'Skip link',
path: '/accessibility',
fragment: 'skip-link',
tryThis: 'Load any page, press Tab once, then Enter.',
expect:
'A link named "Skip to main content" is read first; after Enter, reading continues from the page heading, not the sidebar.',
},
{
pattern: 'Modal dialog',
path: '/accessibility',
fragment: 'focus-trap',
tryThis: 'Activate "Open dialog", Tab through it, then press Escape.',
expect:
'A dialog named "Confirm transfer" is announced on open. Tab stays inside it, and the virtual cursor cannot reach the page behind. Escape closes it and focus lands back on "Open dialog".',
},
{
pattern: 'Live regions',
path: '/accessibility',
fragment: 'live-regions',
tryThis: 'Activate "Announce success", then "Announce error".',
expect:
'Each message is read once without focus moving. The error is assertive, so it may be read sooner, but many readers still finish the current phrase first.',
},
{
pattern: 'Tabs and menu',
path: '/accessibility',
fragment: 'keyboard-navigation',
tryThis:
'Tab to the tabs and use the arrow keys; then open "Row actions" and arrow through it.',
expect:
'Each tab is read with its role, name, position (for example "2 of 3") and selected state. The menu button reports collapsed or expanded; the disabled "Archive" item is read as unavailable.',
},
{
pattern: 'Form errors',
path: '/forms',
fragment: 'typed-reactive-form',
tryThis: 'Tab into "Full name", leave it empty and Tab away, then Tab back.',
expect:
'The error "Full name is required." is announced when it appears. Back on the field, it is read as invalid, with the error as its description.',
},
{
pattern: 'Reorder without dragging',
path: '/accessibility',
fragment: 'wcag-22-dragging',
tryThis: 'Use a "Move up" or "Move down" button in the priorities list.',
expect:
'The new position is announced (for example "Billing moved to position 1 of 4"), and focus stays on a move button for the same item.',
},
];