# Accessibility

Sable's components ship accessible behavior from Base UI. These rules cover what an app composing them still has to get right.

**WCAG AA · 44px touch targets · visible focus · reduced motion · logical properties**

## Floors

| Name | Value | Use |
|---|---|---|
| `Contrast` | 4.5:1 text · 3:1 UI and large text | Every semantic text/surface pair is checked per theme by contrast.test.ts. |
| `Hit area` | 44×44px on touch · 24×24px floor | A control that stands alone (a dialog's close, a banner's dismiss, a code block's copy, a carousel's arrows) grows its target to 44px under a coarse pointer without moving layout (hit-target, or lib/hit-target's hitTargetTouch inside components). Controls packed in a row (pagination numbers, calendar days, chips, tree disclosures) keep the WCAG 2.5.8 24px floor: their pitch sets their target, and a 44px slop would steal taps from the neighbour. |
| `Focus` | ring-2 ring-ring, full opacity | Visible on every interactive element in light and dark. Under forced colors, where every box-shadow ring is dropped, styles.css puts a 2px Highlight outline on :focus-visible instead. |
| `Mobile input text` | ≥ 16px | iOS Safari zooms the page on focus below it. |
| `Reduced motion` | --motion-scale: 0 | Transitions resolve instantly; loaders hold their first frame. |

## Rules

1. **Use the component, not a div with a click handler.** Base UI supplies roles, keyboard handling and focus management. A clickable div has none of them.
2. **Every control has an accessible name.** Icon-only buttons take aria-label. Fields take a <Label> through <Field>, which also wires aria-describedby and aria-invalid.
3. **A live region exists before it has anything to say.** Render role="status" empty from the start and swap its text. A region inserted together with its content is announced inconsistently.
4. **On client-side navigation, update document.title and move focus to the new view's h1.** Route changes are silent to assistive technology unless the app announces them. AppShell supplies the skip link and landmarks; the app does the rest.
5. **Keep submit enabled; validate on submit and focus the first invalid field.** A disabled submit hides why it is disabled. Focus is the only way a screen-reader user finds the error.
6. **Use logical properties: ms-/me-/ps-/pe-/text-start/inset-inline-*.** Flex and grid mirror for free under dir="rtl"; hand-positioned elements do not. *Enforced by design-lint: physical-direction (ratchet).*
7. **Decorative layers over content take pointer-events-none and aria-hidden.** Scrims, glows and fades otherwise swallow clicks on the controls beneath.
8. **Check focus and disabled states under forced-colors: active.** Windows High Contrast overrides ring colors and erases opacity-based disabled styling.

## Never

- **Never:** Color as the only signal (a red border with no message). **Instead:** Color plus text or an icon. Roughly 1 in 12 men cannot tell red from green.
- **Never:** Opacity on the focus ring. **Instead:** ring-ring at full opacity; tune the token in the theme. A faded ring loses the contrast the theme tested. *Enforced by sable-lint: faded-focus-ring.*
- **Never:** A brand or status fill retuned under its old label — dark ink on a bright red that passes 4.5:1 at APCA Lc 42. **Instead:** A label that clears 4.5:1 and APCA Lc 60 in both modes. Move the fill's lightness, not its hue, keeping the ink its colour takes. A status colour on a surface is its own token (`--destructive-text`), so the fill can move freely. The ratio alone passes labels that read muddy. A deliberate brand pair is allowed with a recorded reason (lint disable or preset exceptions). *Enforced by sable-lint: label-contrast.*
- **Never:** A label fill painted on a mark that carries no text — a meter, a segmented bar, a status dot, a chart series, a soft tint. **Instead:** The colour's `-mark` token (`bg-success-mark`, `bg-tone-warning-mark/15`): the same hue lifted and saturated, held to 2:1 on the page. Text contrast is for text; a graphic owes visibility, and 3:1 (WCAG 1.4.11) only when it is the sole carrier of its meaning. A fill is pinned dark enough for a white label. On a bar or dot with nothing to label, that darkness only reads as mud: a brown warning, a forest-green success.
- **Never:** Blocking paste, or type="number" for codes and card numbers. **Instead:** type="text" inputMode="numeric" with the right autocomplete. Blocking paste breaks password managers; number inputs scroll-change identifiers.
- **Never:** forced-color-adjust: none to 'fix' high-contrast mode. **Instead:** Let the system colors apply; verify the result. It removes the user's chosen colors exactly where they need them.
- **Never:** outline: none without a replacement that survives forced colors. **Instead:** focus-visible:outline-hidden with focus-visible:ring-2 ring-ring. outline-hidden is a transparent outline that forced colors paint; a ring alone is a box-shadow, which they drop. Keyboard users lose their place. styles.css restores an outline on :focus-visible under forced colors as a backstop, but a custom focus treatment in an app should not depend on it.

## Details

### An icon-only button

```tsx
// before
<Button size="icon"><Icon name="xmark" /></Button>
// after
<Button size="icon" aria-label="Close"><Icon name="xmark" /></Button>
```

Without a name, a screen reader announces only 'button'.

### A status that announces

```tsx
// before
{saved && <p role="status">Saved</p>}
// after
<p role="status">{saved ? "Saved" : ""}</p>
```

The region is in the accessibility tree before its text changes, so the change is announced.

**Related:** `sable docs typography` · `sable docs motion` · `sable component <Name> --a11y`
