Frontend Design
Intro
Good frontend design starts with semantic HTML, small
single-responsibility components, and WCAG 2.2 AA accessibility, then
layers on performance, state management, and rendering strategy as the
app grows. Apply these conventions when designing or reviewing any
frontend application.
Overview
Component architecture
Build a tree of small, single-responsibility components. Separate
container (data/logic) from presentational (UI) components, and
co-locate related files (Button/Button.tsx, Button.test.tsx,
Button.module.css). Prefer composition — children and slots — over
deep prop configuration. Name components by what they are
(UserAvatar), not where they live (SidebarIcon).
Semantic HTML first
Start with the correct HTML element before reaching for ARIA:
<nav>, <main>, <aside>, <header>, <footer> for landmarks.
<button> for actions, <a> for navigation — never
<div onClick>.
<ul> / <ol> for lists, <table> for tabular data.
<h1> through <h6> in logical order, no skipping levels.
<dialog> for modals, <details> for disclosure widgets.
Every <img> needs alt (use alt="" for decorative images). Every
form input needs a visible <label> with matching for / id. Add
ARIA only when HTML semantics are insufficient.
Accessibility (WCAG 2.2 AA)
- Keyboard navigation: all interactive elements reachable and
operable via keyboard.
- Focus management: visible indicator, logical tab order, no focus
traps.
- Color contrast: 4.5:1 normal text, 3:1 large text and UI
components.
- Target size: at least 24x24 CSS pixels (WCAG 2.5.8).
- Motion: respect
prefers-reduced-motion; no auto-playing
animations over 5 seconds.
- Error handling: identify errors clearly, suggest corrections,
prevent data loss.
- Screen readers:
aria-live for dynamic updates, aria-label for
icon buttons.
- Authentication: no cognitive-function tests (WCAG 3.3.8).
See Level 3 for the full WCAG 2.2 AA checklist.
State management
Pick the simplest approach that fits the complexity:
| Complexity |
Solution |
| Local UI state |
useState, useReducer |
| Shared across few |
Lift state up, prop drilling (if shallow) |
| Shared across many |
React Context (low-frequency updates) |
| Complex global |
Zustand (simple API), Jotai (atomic), Redux (large teams) |
| Server state |
TanStack Query / SWR (caching, revalidation, dedup) |
| URL state |
Search params via router (useSearchParams) |
| Form state |
React Hook Form or Conform (validation, performance) |
Avoid putting everything in global state — most state is local.
Server state is not client state; use a dedicated data-fetching
library. Derive computed values instead of storing them separately.
React / Next.js patterns
Server Components (default in App Router) fetch data on the server
and ship zero JS. Add "use client" only when you need interactivity,
hooks, or browser APIs. Use <Suspense> boundaries to stream UI
progressively. Fetch data in Server Components and use TanStack Query
for client mutations. Pick a rendering strategy per route: SSG for
static, SSR for personalized, ISR for hybrid. Export metadata or
generateMetadata for SEO on each route.
Performance (Core Web Vitals)
Optimize to the three Core Web Vitals thresholds:
- LCP (< 2.5s): preload hero images, use
next/image with
priority, minimize render-blocking CSS/JS, inline critical CSS,
lean on Server Components to cut client JS.
- INP (< 200ms): avoid long tasks on the main thread, break work
with
startTransition, debounce expensive handlers, virtualize
long lists, use useOptimistic for instant feedback.
- CLS (< 0.1): set explicit
width / height on media, reserve
space for dynamic content with skeletons, never inject content
above existing content.
Analyze bundles with @next/bundle-analyzer, lazy-load heavy
components, and load fonts via next/font for zero layout shift.
Styling approaches
| Approach |
Best for |
Trade-offs |
| Tailwind CSS |
Rapid development, consistency |
Long class strings, learning curve |
| CSS Modules |
Scoped styles, small bundles |
More files, less dynamic |
| Vanilla CSS |
Simple projects, standards |
No scoping, manual organization |
| CSS-in-JS |
Dynamic styles, co-location |
Runtime cost, SSR complexity |
Prefer Tailwind or CSS Modules for new projects (zero runtime cost).
Avoid runtime CSS-in-JS in Server Components. Use CSS custom
properties for theming and keep design tokens in one place.
Project structure (Next.js App Router)
src/
app/ # Routes, layouts, pages
(marketing)/ # Route groups
dashboard/
page.tsx
loading.tsx
error.tsx
layout.tsx
globals.css
components/
ui/ # Shared primitives (Button, Input, Card)
features/ # Feature-specific components
lib/ # Utilities, helpers, constants
hooks/ # Custom React hooks
types/ # Shared TypeScript types
Group by feature for large apps, by type for small ones. Keep
components/ui/ framework-agnostic where possible, and export barrel
files (index.ts) only for public component APIs.
Gotchas
Agent-specific failure modes — provider-neutral pause-and-self-check items:
- Using
<div onClick> instead of <button> for interactive elements. A <div> is not keyboard-focusable, has no implicit ARIA role, and does not fire click events on Enter/Space. Keyboard users and assistive technology users cannot interact with it. Use the correct semantic HTML element first.
- Putting all state in a global store. Global stores cause unrelated components to re-render on every update and make the data flow hard to trace. Most state is local; lift it up only when genuinely shared; use a dedicated data-fetching library for server state.
- Adding
"use client" to a Next.js component to "make it work" without understanding why. Every "use client" boundary ships JavaScript to the browser. Adding it to a parent makes every descendant a client component. Diagnose why the component needs interactivity and push the boundary as far down the tree as possible.
- Hardcoding colors, font sizes, or spacing values in components. Hardcoded values bypass the design token system and make theming, dark mode, and accessibility changes require a search-and-replace across the codebase. Define tokens in one place and reference them everywhere.
- Omitting
alt on images or using generic text like "image". An <img alt="image"> is meaningless to a screen reader user. Decorative images need alt="" to be skipped; meaningful images need descriptive text that conveys their content.
- No
aria-live for dynamic updates. When content changes without a page reload (search results, error messages, toast notifications), assistive technology does not announce the change unless a live region is used. Wrap dynamic status updates in an aria-live="polite" region.
- Optimizing Core Web Vitals last. LCP, INP, and CLS regressions are cheapest to fix when the component is first written. Setting explicit
width/height on images, using priority on above-fold images, and avoiding long main-thread tasks are design decisions, not afterthoughts.
Full reference
WCAG 2.2 AA checklist
Criteria marked (A) are Level A; (AA) are Level AA. Both are required
for AA conformance.
Perceivable — Text alternatives:
- 1.1.1 Non-text Content (A) — all images, icons, and buttons have
descriptive
alt; decorative images use alt="" or CSS.
Perceivable — Time-based media:
- 1.2.1 Audio/Video Only (A) — transcripts for audio-only,
transcripts or audio descriptions for video-only.
- 1.2.2 Captions Prerecorded (A) — synchronized captions on
prerecorded video.
- 1.2.3 Audio Description (A) — audio description or descriptive
transcript for video.
- 1.2.4 Captions Live (AA) — real-time captions for live audio.
Perceivable — Adaptable:
- 1.3.1 Info and Relationships (A) — semantic HTML for headings,
landmarks, lists, table headers; do not rely on visual styling.
- 1.3.2 Meaningful Sequence (A) — DOM order matches visual reading
order.
- 1.3.3 Sensory Characteristics (A) — instructions do not rely solely
on shape, color, size, or location.
- 1.3.4 Orientation (AA) — content works in portrait and landscape.
- 1.3.5 Identify Input Purpose (AA) — form fields use appropriate
autocomplete attributes.
Perceivable — Distinguishable:
- 1.4.1 Use of Color (A) — color is not the only cue.
- 1.4.2 Audio Control (A) — auto-playing audio over 3s can be paused
or adjusted.
- 1.4.3 Contrast Minimum (AA) — 4.5:1 normal text, 3:1 large text
(18pt+ or 14pt+ bold).
- 1.4.4 Resize Text (AA) — readable and functional at 200% zoom.
- 1.4.5 Images of Text (AA) — use real text, not images of text.
- 1.4.10 Reflow (AA) — no horizontal scrolling at 320px viewport
(1280px at 400% zoom).
- 1.4.11 Non-text Contrast (AA) — 3:1 for UI components and graphical
objects.
- 1.4.12 Text Spacing (AA) — no content loss with overridden line
height (1.5x), paragraph spacing (2x), letter spacing (0.12em),
word spacing (0.16em).
- 1.4.13 Content on Hover/Focus (AA) — tooltips dismissible,
hoverable, persistent until dismissed.
Operable — Keyboard:
- 2.1.1 Keyboard (A) — all functionality keyboard-accessible.
- 2.1.2 No Keyboard Trap (A) — focus can always move away.
Operable — Enough time & seizures:
- 2.2.1 Timing Adjustable (A) — time limits can be turned off or
extended.
- 2.2.2 Pause, Stop, Hide (A) — auto-moving content over 5s can be
paused.
- 2.3.1 Three Flashes (A) — no more than 3 flashes per second.
Operable — Navigable:
- 2.4.1 Bypass Blocks (A) — "skip to main content" link.
- 2.4.2 Page Titled (A) — descriptive
<title>.
- 2.4.3 Focus Order (A) — logical tab order.
- 2.4.4 Link Purpose (A) — link text describes the destination.
- 2.4.5 Multiple Ways (AA) — at least two ways to find pages.
- 2.4.6 Headings and Labels (AA) — descriptive headings and labels.
- 2.4.7 Focus Visible (AA) — clearly visible focus indicator.
- 2.4.11 Focus Not Obscured (AA) — focused elements not hidden by
sticky UI.
Operable — Input modalities:
- 2.5.1 Pointer Gestures (A) — multi-finger/path gestures have
single-pointer alternatives.
- 2.5.2 Pointer Cancellation (A) — actions fire on pointer up and can
be aborted.
- 2.5.3 Label in Name (A) — visible label text is in the accessible
name.
- 2.5.4 Motion Actuation (A) — shake/tilt has button alternatives.
- 2.5.7 Dragging Movements (AA) — drag-and-drop has a non-drag
alternative.
- 2.5.8 Target Size Minimum (AA) — interactive targets at least
24x24 CSS pixels.
Understandable:
- 3.1.1 Language of Page (A) —
<html lang="...">.
- 3.1.2 Language of Parts (AA) —
lang attribute on foreign content.
- 3.2.1 On Focus (A) — focus does not trigger unexpected changes.
- 3.2.2 On Input (A) — input changes do not cause unexpected
navigation.
- 3.2.3 Consistent Navigation (AA) — navigation order consistent
across pages.
- 3.2.4 Consistent Identification (AA) — same functionality uses same
labels.
- 3.3.1 Error Identification (A) — errors clearly described in text.
- 3.3.2 Labels or Instructions (A) — visible labels or instructions.
- 3.3.3 Error Suggestion (AA) — suggest how to fix errors.
- 3.3.4 Error Prevention (AA) — reversible, verified, or confirmed
for legal/financial data.
- 3.3.7 Redundant Entry (A) — previously entered info auto-populated.
- 3.3.8 Accessible Authentication (AA) — no cognitive tests, allow
paste, support password managers.
Robust:
- 4.1.2 Name, Role, Value (A) — custom components expose name, role,
state via ARIA; prefer native HTML.
- 4.1.3 Status Messages (AA) — dynamic status announced via
aria-live or role="alert".
ARIA patterns
<!-- Icon button -->
<button aria-label="Close dialog">
<svg aria-hidden="true">...</svg>
</button>
<!-- Live region for dynamic updates -->
<div aria-live="polite" aria-atomic="true">
3 items in cart
</div>
<!-- Form with error -->
<label for="email">Email</label>
<input id="email" type="email" aria-invalid="true" aria-describedby="email-error">
<p id="email-error" role="alert">Please enter a valid email address.</p>
<!-- Modal dialog -->
<dialog aria-labelledby="dialog-title">
<h2 id="dialog-title">Confirm deletion</h2>
...
</dialog>
Base HTML skeleton:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Descriptive Page Title</title>
</head>
<body>
<a href="#main" class="sr-only focus:not-sr-only">Skip to main content</a>
<header><nav aria-label="Main">...</nav></header>
<main id="main">...</main>
<footer>...</footer>
</body>
</html>
Testing tools
- axe DevTools — browser extension for automated checks.
- Lighthouse — accessibility audit in Chrome DevTools.
- NVDA (Windows) / VoiceOver (macOS) — screen reader testing.
- Keyboard-only navigation — unplug the mouse, test every flow.
- Colour Contrast Analyser — verify contrast ratios.
- WAVE — web accessibility evaluation tool.
Further reading
1---2name: frontend-design3description: |4 Frontend architecture and UI design — component hierarchies, accessibility, performance, state management. Use when designing frontend architecture, building component hierarchies, making something accessible, optimizing Core Web Vitals, or choosing a state management approach.5metadata:6 source: https://skillmd.com/skills/projectious-work/frontend-design7 processkit:8 apiVersion: processkit.projectious.work/v19 id: SKILL-frontend-design10 version: "1.1.0"11 created: 2026-04-06T00:00:00Z12 category: design13---1415# Frontend Design1617## Intro1819Good frontend design starts with semantic HTML, small20single-responsibility components, and WCAG 2.2 AA accessibility, then21layers on performance, state management, and rendering strategy as the22app grows. Apply these conventions when designing or reviewing any23frontend application.2425## Overview2627### Component architecture2829Build a tree of small, single-responsibility components. Separate30container (data/logic) from presentational (UI) components, and31co-locate related files (`Button/Button.tsx`, `Button.test.tsx`,32`Button.module.css`). Prefer composition — children and slots — over33deep prop configuration. Name components by what they are34(`UserAvatar`), not where they live (`SidebarIcon`).3536### Semantic HTML first3738Start with the correct HTML element before reaching for ARIA:3940- `<nav>`, `<main>`, `<aside>`, `<header>`, `<footer>` for landmarks.41- `<button>` for actions, `<a>` for navigation — never42 `<div onClick>`.43- `<ul>` / `<ol>` for lists, `<table>` for tabular data.44- `<h1>` through `<h6>` in logical order, no skipping levels.45- `<dialog>` for modals, `<details>` for disclosure widgets.4647Every `<img>` needs `alt` (use `alt=""` for decorative images). Every48form input needs a visible `<label>` with matching `for` / `id`. Add49ARIA only when HTML semantics are insufficient.5051### Accessibility (WCAG 2.2 AA)5253- Keyboard navigation: all interactive elements reachable and54 operable via keyboard.55- Focus management: visible indicator, logical tab order, no focus56 traps.57- Color contrast: 4.5:1 normal text, 3:1 large text and UI58 components.59- Target size: at least 24x24 CSS pixels (WCAG 2.5.8).60- Motion: respect `prefers-reduced-motion`; no auto-playing61 animations over 5 seconds.62- Error handling: identify errors clearly, suggest corrections,63 prevent data loss.64- Screen readers: `aria-live` for dynamic updates, `aria-label` for65 icon buttons.66- Authentication: no cognitive-function tests (WCAG 3.3.8).6768See Level 3 for the full WCAG 2.2 AA checklist.6970### State management7172Pick the simplest approach that fits the complexity:7374| Complexity | Solution |75|-------------------|--------------------------------------------------------|76| Local UI state | `useState`, `useReducer` |77| Shared across few | Lift state up, prop drilling (if shallow) |78| Shared across many| React Context (low-frequency updates) |79| Complex global | Zustand (simple API), Jotai (atomic), Redux (large teams) |80| Server state | TanStack Query / SWR (caching, revalidation, dedup) |81| URL state | Search params via router (`useSearchParams`) |82| Form state | React Hook Form or Conform (validation, performance) |8384Avoid putting everything in global state — most state is local.85Server state is not client state; use a dedicated data-fetching86library. Derive computed values instead of storing them separately.8788### React / Next.js patterns8990Server Components (default in App Router) fetch data on the server91and ship zero JS. Add `"use client"` only when you need interactivity,92hooks, or browser APIs. Use `<Suspense>` boundaries to stream UI93progressively. Fetch data in Server Components and use TanStack Query94for client mutations. Pick a rendering strategy per route: SSG for95static, SSR for personalized, ISR for hybrid. Export `metadata` or96`generateMetadata` for SEO on each route.9798### Performance (Core Web Vitals)99100Optimize to the three Core Web Vitals thresholds:101102- **LCP (< 2.5s):** preload hero images, use `next/image` with103 `priority`, minimize render-blocking CSS/JS, inline critical CSS,104 lean on Server Components to cut client JS.105- **INP (< 200ms):** avoid long tasks on the main thread, break work106 with `startTransition`, debounce expensive handlers, virtualize107 long lists, use `useOptimistic` for instant feedback.108- **CLS (< 0.1):** set explicit `width` / `height` on media, reserve109 space for dynamic content with skeletons, never inject content110 above existing content.111112Analyze bundles with `@next/bundle-analyzer`, lazy-load heavy113components, and load fonts via `next/font` for zero layout shift.114115### Styling approaches116117| Approach | Best for | Trade-offs |118|----------------|---------------------------------|----------------------------------|119| Tailwind CSS | Rapid development, consistency | Long class strings, learning curve |120| CSS Modules | Scoped styles, small bundles | More files, less dynamic |121| Vanilla CSS | Simple projects, standards | No scoping, manual organization |122| CSS-in-JS | Dynamic styles, co-location | Runtime cost, SSR complexity |123124Prefer Tailwind or CSS Modules for new projects (zero runtime cost).125Avoid runtime CSS-in-JS in Server Components. Use CSS custom126properties for theming and keep design tokens in one place.127128### Project structure (Next.js App Router)129130```131src/132 app/ # Routes, layouts, pages133 (marketing)/ # Route groups134 dashboard/135 page.tsx136 loading.tsx137 error.tsx138 layout.tsx139 globals.css140 components/141 ui/ # Shared primitives (Button, Input, Card)142 features/ # Feature-specific components143 lib/ # Utilities, helpers, constants144 hooks/ # Custom React hooks145 types/ # Shared TypeScript types146```147148Group by feature for large apps, by type for small ones. Keep149`components/ui/` framework-agnostic where possible, and export barrel150files (`index.ts`) only for public component APIs.151152## Gotchas153154Agent-specific failure modes — provider-neutral pause-and-self-check items:155156- **Using `<div onClick>` instead of `<button>` for interactive elements.** A `<div>` is not keyboard-focusable, has no implicit ARIA role, and does not fire click events on Enter/Space. Keyboard users and assistive technology users cannot interact with it. Use the correct semantic HTML element first.157- **Putting all state in a global store.** Global stores cause unrelated components to re-render on every update and make the data flow hard to trace. Most state is local; lift it up only when genuinely shared; use a dedicated data-fetching library for server state.158- **Adding `"use client"` to a Next.js component to "make it work" without understanding why.** Every `"use client"` boundary ships JavaScript to the browser. Adding it to a parent makes every descendant a client component. Diagnose why the component needs interactivity and push the boundary as far down the tree as possible.159- **Hardcoding colors, font sizes, or spacing values in components.** Hardcoded values bypass the design token system and make theming, dark mode, and accessibility changes require a search-and-replace across the codebase. Define tokens in one place and reference them everywhere.160- **Omitting `alt` on images or using generic text like "image".** An `<img alt="image">` is meaningless to a screen reader user. Decorative images need `alt=""` to be skipped; meaningful images need descriptive text that conveys their content.161- **No `aria-live` for dynamic updates.** When content changes without a page reload (search results, error messages, toast notifications), assistive technology does not announce the change unless a live region is used. Wrap dynamic status updates in an `aria-live="polite"` region.162- **Optimizing Core Web Vitals last.** LCP, INP, and CLS regressions are cheapest to fix when the component is first written. Setting explicit `width`/`height` on images, using `priority` on above-fold images, and avoiding long main-thread tasks are design decisions, not afterthoughts.163164## Full reference165166### WCAG 2.2 AA checklist167168Criteria marked (A) are Level A; (AA) are Level AA. Both are required169for AA conformance.170171**Perceivable — Text alternatives:**172173- 1.1.1 Non-text Content (A) — all images, icons, and buttons have174 descriptive `alt`; decorative images use `alt=""` or CSS.175176**Perceivable — Time-based media:**177178- 1.2.1 Audio/Video Only (A) — transcripts for audio-only,179 transcripts or audio descriptions for video-only.180- 1.2.2 Captions Prerecorded (A) — synchronized captions on181 prerecorded video.182- 1.2.3 Audio Description (A) — audio description or descriptive183 transcript for video.184- 1.2.4 Captions Live (AA) — real-time captions for live audio.185186**Perceivable — Adaptable:**187188- 1.3.1 Info and Relationships (A) — semantic HTML for headings,189 landmarks, lists, table headers; do not rely on visual styling.190- 1.3.2 Meaningful Sequence (A) — DOM order matches visual reading191 order.192- 1.3.3 Sensory Characteristics (A) — instructions do not rely solely193 on shape, color, size, or location.194- 1.3.4 Orientation (AA) — content works in portrait and landscape.195- 1.3.5 Identify Input Purpose (AA) — form fields use appropriate196 `autocomplete` attributes.197198**Perceivable — Distinguishable:**199200- 1.4.1 Use of Color (A) — color is not the only cue.201- 1.4.2 Audio Control (A) — auto-playing audio over 3s can be paused202 or adjusted.203- 1.4.3 Contrast Minimum (AA) — 4.5:1 normal text, 3:1 large text204 (18pt+ or 14pt+ bold).205- 1.4.4 Resize Text (AA) — readable and functional at 200% zoom.206- 1.4.5 Images of Text (AA) — use real text, not images of text.207- 1.4.10 Reflow (AA) — no horizontal scrolling at 320px viewport208 (1280px at 400% zoom).209- 1.4.11 Non-text Contrast (AA) — 3:1 for UI components and graphical210 objects.211- 1.4.12 Text Spacing (AA) — no content loss with overridden line212 height (1.5x), paragraph spacing (2x), letter spacing (0.12em),213 word spacing (0.16em).214- 1.4.13 Content on Hover/Focus (AA) — tooltips dismissible,215 hoverable, persistent until dismissed.216217**Operable — Keyboard:**218219- 2.1.1 Keyboard (A) — all functionality keyboard-accessible.220- 2.1.2 No Keyboard Trap (A) — focus can always move away.221222**Operable — Enough time & seizures:**223224- 2.2.1 Timing Adjustable (A) — time limits can be turned off or225 extended.226- 2.2.2 Pause, Stop, Hide (A) — auto-moving content over 5s can be227 paused.228- 2.3.1 Three Flashes (A) — no more than 3 flashes per second.229230**Operable — Navigable:**231232- 2.4.1 Bypass Blocks (A) — "skip to main content" link.233- 2.4.2 Page Titled (A) — descriptive `<title>`.234- 2.4.3 Focus Order (A) — logical tab order.235- 2.4.4 Link Purpose (A) — link text describes the destination.236- 2.4.5 Multiple Ways (AA) — at least two ways to find pages.237- 2.4.6 Headings and Labels (AA) — descriptive headings and labels.238- 2.4.7 Focus Visible (AA) — clearly visible focus indicator.239- 2.4.11 Focus Not Obscured (AA) — focused elements not hidden by240 sticky UI.241242**Operable — Input modalities:**243244- 2.5.1 Pointer Gestures (A) — multi-finger/path gestures have245 single-pointer alternatives.246- 2.5.2 Pointer Cancellation (A) — actions fire on pointer up and can247 be aborted.248- 2.5.3 Label in Name (A) — visible label text is in the accessible249 name.250- 2.5.4 Motion Actuation (A) — shake/tilt has button alternatives.251- 2.5.7 Dragging Movements (AA) — drag-and-drop has a non-drag252 alternative.253- 2.5.8 Target Size Minimum (AA) — interactive targets at least254 24x24 CSS pixels.255256**Understandable:**257258- 3.1.1 Language of Page (A) — `<html lang="...">`.259- 3.1.2 Language of Parts (AA) — `lang` attribute on foreign content.260- 3.2.1 On Focus (A) — focus does not trigger unexpected changes.261- 3.2.2 On Input (A) — input changes do not cause unexpected262 navigation.263- 3.2.3 Consistent Navigation (AA) — navigation order consistent264 across pages.265- 3.2.4 Consistent Identification (AA) — same functionality uses same266 labels.267- 3.3.1 Error Identification (A) — errors clearly described in text.268- 3.3.2 Labels or Instructions (A) — visible labels or instructions.269- 3.3.3 Error Suggestion (AA) — suggest how to fix errors.270- 3.3.4 Error Prevention (AA) — reversible, verified, or confirmed271 for legal/financial data.272- 3.3.7 Redundant Entry (A) — previously entered info auto-populated.273- 3.3.8 Accessible Authentication (AA) — no cognitive tests, allow274 paste, support password managers.275276**Robust:**277278- 4.1.2 Name, Role, Value (A) — custom components expose name, role,279 state via ARIA; prefer native HTML.280- 4.1.3 Status Messages (AA) — dynamic status announced via281 `aria-live` or `role="alert"`.282283### ARIA patterns284285```html286<!-- Icon button -->287<button aria-label="Close dialog">288 <svg aria-hidden="true">...</svg>289</button>290291<!-- Live region for dynamic updates -->292<div aria-live="polite" aria-atomic="true">293 3 items in cart294</div>295296<!-- Form with error -->297<label for="email">Email</label>298<input id="email" type="email" aria-invalid="true" aria-describedby="email-error">299<p id="email-error" role="alert">Please enter a valid email address.</p>300301<!-- Modal dialog -->302<dialog aria-labelledby="dialog-title">303 <h2 id="dialog-title">Confirm deletion</h2>304 ...305</dialog>306```307308Base HTML skeleton:309310```html311<!DOCTYPE html>312<html lang="en">313<head>314 <meta charset="UTF-8">315 <meta name="viewport" content="width=device-width, initial-scale=1.0">316 <title>Descriptive Page Title</title>317</head>318<body>319 <a href="#main" class="sr-only focus:not-sr-only">Skip to main content</a>320 <header><nav aria-label="Main">...</nav></header>321 <main id="main">...</main>322 <footer>...</footer>323</body>324</html>325```326327### Testing tools328329- **axe DevTools** — browser extension for automated checks.330- **Lighthouse** — accessibility audit in Chrome DevTools.331- **NVDA** (Windows) / **VoiceOver** (macOS) — screen reader testing.332- **Keyboard-only navigation** — unplug the mouse, test every flow.333- **Colour Contrast Analyser** — verify contrast ratios.334- **WAVE** — web accessibility evaluation tool.335336### Further reading337338- `references/accessibility-checklist.md` — source for the WCAG 2.2339 AA checklist above.340- [React documentation](https://react.dev)341- [Next.js documentation](https://nextjs.org/docs)342- [Web Content Accessibility Guidelines 2.2](https://www.w3.org/TR/WCAG22/)