# Accessible By Default

> Non-negotiable accessibility baseline for any UI an agent builds or restyles: WCAG 2.2 AA contrast, visible focus, 24x24 target size, reduced motion, semantic HTML, text alternatives, and never relying on color alone. Includes a pass/fail checklist and code patterns. Use this skill when building or reviewing any user-facing UI, especially after a visual redesign, or when a distinctive style risks readability. Activate when: accessibility, a11y, WCAG, contrast, focus ring, keyboard navigation, reduced motion, alt text, screen reader, target size, semantic HTML.

- Skill: `latestaiagents/accessible-by-default` (Agent Skill)
- Install (CLI): `npx get-skill add latestaiagents/accessible-by-default`
- Raw SKILL.md: https://api.skillmd.com/api/skills/latestaiagents/accessible-by-default/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: latestaiagents (https://skillmd.com/u/latestaiagents)
- Updated: 2026-11-14
- Page: https://skillmd.com/skills/latestaiagents/accessible-by-default

---


# Accessible by Default

**Distinctive design is optional; accessible design is not. Apply this baseline to every screen, whatever the visual direction.**

This skill covers the checks that most often break when agents restyle UI. It targets WCAG 2.2 Level AA, a widely used target in accessibility policies. It is a baseline, not a full conformance audit: automated and checklist review do not replace testing with assistive technology and with disabled users.

## When to Use

- Building any page or component
- After applying a new visual direction, palette, or motion system
- Reviewing a PR that changes CSS, colors, interactive elements, or animation

## Workflow

### Step 1: Use Semantic HTML First

Native elements bring keyboard support, focus, and roles for free.

```html
<!-- Before -->
<div class="btn" onclick="save()">Save</div>

<!-- After -->
<button type="button" onclick="save()">Save draft</button>
```

- Links navigate (`<a href>`); buttons act (`<button>`)
- One `<h1>` per page and headings in order; use `<main>`, `<nav>`, `<header>`, `<footer>` landmarks
- Every input has a `<label>` (visible, associated with `for`/`id` or by wrapping)
- Use ARIA only when no native element fits, and then follow the ARIA pattern fully

### Step 2: Meet Contrast Thresholds (Unrounded)

| What | Ratio | WCAG 2.2 |
|------|-------|----------|
| Normal text | 4.5:1 | 1.4.3 Contrast (Minimum), AA |
| Large text: at least 18pt, or 14pt bold (about 24px / 18.5px) | 3:1 | 1.4.3, AA |
| UI component boundaries and states, meaningful graphics, focus indicators | 3:1 against adjacent colors | 1.4.11 Non-text Contrast, AA |
| Enhanced (optional) | 7:1 / 4.5:1 large | 1.4.6, AAA |

W3C states ratios are not rounded: 4.499:1 fails 4.5:1. Logos and purely decorative text are exempt. Check text over images or gradients at the lowest-contrast point.

### Step 3: Keep Focus Visible and Unobscured

```css
/* Never remove focus without replacing it */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
```

- 2.4.7 Focus Visible (AA): keyboard focus must be visible. `outline: none` without a replacement fails
- 2.4.11 Focus Not Obscured (Minimum) (AA, new in 2.2): a focused element must not be entirely hidden by author content such as sticky headers or cookie banners. Use `scroll-padding-top` for sticky headers
- 2.4.13 Focus Appearance (AAA) defines a stronger indicator (area at least a 2 CSS px perimeter, 3:1 contrast); a useful target even if you only claim AA
- `:focus-visible` is Baseline widely available and shows the ring for keyboard users without showing it on every mouse click

```css
html { scroll-padding-top: 5rem; } /* height of the sticky header */
```

### Step 4: Size Targets for Pointers and Fingers

2.5.8 Target Size (Minimum) (AA, new in 2.2): pointer targets at least 24 by 24 CSS pixels, unless an exception applies — enough spacing (a 24px circle centered on each target doesn't overlap another), an equivalent larger control on the page, inline links in text, user-agent default controls, or essential presentation. 2.5.5 (AAA) asks for 44 by 44.

```css
.icon-button {
  min-width: 44px;   /* exceeds the 24px AA minimum; matches the AAA size */
  min-height: 44px;
  display: inline-grid;
  place-items: center;
}
```

### Step 5: Respect Motion Preferences

- `prefers-reduced-motion: reduce` indicates the user asked to minimize non-essential motion (Baseline widely available)
- 2.2.2 Pause, Stop, Hide (A): auto-moving content that lasts more than 5 seconds alongside other content needs a way to pause, stop, or hide it
- 2.3.3 Animation from Interactions (AAA): interaction-triggered motion can be disabled unless essential

```css
@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;
  }
}
```

The blanket rule is a safety net. Better: design the reduced version deliberately (crossfade instead of slide, no parallax) so meaning conveyed by motion is not lost.

### Step 6: Never Use Color Alone

1.4.1 Use of Color (A): color cannot be the only way to convey information, indicate an action, or distinguish an element.

```html
<!-- Before: red border is the only error signal -->
<input class="border-red">

<!-- After -->
<label for="email">Email</label>
<input id="email" type="email" aria-invalid="true" aria-describedby="email-err">
<p id="email-err" class="error">Enter an email address like name@example.com</p>
```

Links inside body text should be distinguishable by more than color (underline is the simplest choice).

### Step 7: Provide Text Alternatives

1.1.1 Non-text Content (A):

- Informative image: `alt` describes the information, not the file ("Invoice total 336 EUR, due 30 November")
- Decorative image: `alt=""` so screen readers skip it
- Icon-only button: accessible name via visible text, `aria-label`, or visually hidden text
- Charts: a text summary or data table nearby

### Step 8: Allow Zoom, Reflow, and Text Spacing

- 1.4.10 Reflow (AA): content works without two-direction scrolling at 320 CSS px wide (vertical content) — test at 400% zoom on a 1280px window
- 1.4.12 Text Spacing (AA): no loss of content when users raise line height to 1.5x, paragraph spacing 2x, letter spacing 0.12x, word spacing 0.16x
- Never set `maximum-scale=1` or `user-scalable=no` in the viewport meta

### Step 9: Verify

| Check | How |
|-------|-----|
| Keyboard | Tab through the whole page: every control reachable, order logical, focus always visible, no traps |
| Contrast | Contrast checker on every text/background and component pair, both themes |
| Zoom/reflow | 400% zoom at 1280px width; 320px viewport |
| Motion | Turn on the OS reduced-motion setting and reload |
| Screen reader | Spot-check headings, landmarks, form labels, and buttons with VoiceOver or NVDA |
| Automated | Run an automated checker; treat it as a floor (it finds only some issues) |

## Best Practices

1. Native HTML before ARIA
2. Contrast ratios are thresholds, checked unrounded, in every theme
3. Replace focus styles; never just remove them
4. Account for sticky UI hiding focused elements
5. Size touch targets generously; 24px is the AA floor, not a goal
6. Design the reduced-motion experience, don't only switch motion off
7. Pair color with text, shape, or pattern
8. Test with a keyboard on every change; it takes minutes

## References

- WCAG 2.2: https://www.w3.org/TR/WCAG22/
- Understanding 1.4.3 Contrast (Minimum): https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html
- Understanding 2.5.8 Target Size (Minimum): https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html
- Understanding 2.5.5 Target Size (Enhanced): https://www.w3.org/WAI/WCAG22/Understanding/target-size-enhanced.html
- Understanding 1.4.10 Reflow: https://www.w3.org/WAI/WCAG22/Understanding/reflow.html
- MDN, `prefers-reduced-motion`: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion
- MDN, `:focus-visible`: https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible

