ui/docs/design-system/accessibility.md
OpenClaw targets WCAG 2.1 AA. This checklist applies to every UI component — use it when building new components and during PR review.
| Context | Minimum Ratio | Notes |
|---|---|---|
| Normal body text (< 18px / < 14px bold) | 4.5:1 | Use --text (#d4d4d8) or stronger on --bg |
| Large text (≥ 18px regular / ≥ 14px bold) | 3:1 | Headings in chat thread |
| UI component boundaries (inputs, buttons) | 3:1 | Border colours against adjacent background |
| Focus indicators | 3:1 (AA) | --focus-ring / --focus-glow already compliant |
| Placeholder text | Best-effort ≥3:1 | --muted (#838387) is ~5:1 on --bg — acceptable |
Verify with WebAIM Contrast Checker or browser DevTools accessibility panel.
:focus-visible style--focus-ring box-shadow pattern from base.css — do not remove the outline without replacing itoutline: none alone; replace with box-shadow: var(--focus-ring) and outline: none/* Correct pattern */
.my-button:focus-visible {
outline: none;
box-shadow: var(--focus-ring);
}
min-width: 44px; min-height: 44px)@media (max-width: 768px))#skip-to-main) is present in the document roottabindex="-1" to accept programmatic focus<a id="skip-to-main" href="#main-content" class="skip-link">Skip to main content</a>
.skip-link {
position: absolute;
left: -9999px;
top: 0;
z-index: 9999;
}
.skip-link:focus {
left: 1rem;
top: 1rem;
/* ... visible styles */
}
aria-label describing the action (not the icon name)role="progressbar" with aria-valuenow, aria-valuemin, aria-valuemaxaria-live="polite" (or "assertive" for critical alerts)aria-hidden="true"<!-- Correct: icon button -->
<button aria-label="Send message">
<svg aria-hidden="true"><!-- ... --></svg>
</button>
<!-- Correct: progress bar -->
<div
role="progressbar"
aria-valuenow="42"
aria-valuemin="0"
aria-valuemax="100"
aria-label="Context window usage"
>
<div style="width: 42%"></div>
</div>
When building a tab interface:
role="tablist"role="tab", aria-selected="true|false", aria-controls="panel-id"role="tabpanel", id matching aria-controls, aria-labelledby pointing to its tab<div role="tablist" aria-label="Main navigation">
<button role="tab" aria-selected="true" aria-controls="chat-panel" id="chat-tab">Chat</button>
<button role="tab" aria-selected="false" aria-controls="settings-panel" id="settings-tab">
Settings
</button>
</div>
<div role="tabpanel" id="chat-panel" aria-labelledby="chat-tab"><!-- ... --></div>
<div role="tabpanel" id="settings-panel" aria-labelledby="settings-tab" hidden><!-- ... --></div>
prefers-reduced-motionbase.css covers transitions — test with "Reduce motion" enabled in OS settingsshimmer, spinners) have explicit animation: none in reduced-motion context<button>, <a>, <input>) before adding ARIA to <div> / <span><h1>–<h6>) reflect document hierarchy — do not skip levels<ul> / <ol> + <li>, not chains of <div>| Tool | Purpose |
|---|---|
| Chrome DevTools → Accessibility tab | Inspect ARIA tree, contrast |
| axe DevTools (browser extension) | Automated WCAG audit |
macOS VoiceOver (Cmd+F5) | Screen reader smoke test |
prefers-reduced-motion: reduce (DevTools → Rendering) | Verify animation suppression |
| Keyboard-only navigation | Tab through entire UI without mouse |