Accessibility
Fern supports accessibility standards out of the box.
Reach for it when
- Before shipping any control, list, dialog or animation.
- When choosing a text token for a surface, check the live contrast table.
The short version
If you read nothing else on this page, read these.
LivePublishingError
Do. Pair every status hue with a label or an icon.
docs.acme.devdocs.acme.devdocs.acme.dev
Don't. Carry status by color alone. About 1 in 12 men can't tell these dots apart.
Do. Keep row actions at 32px, 8px apart, with a name for screen readers.
Don't. Shrink a control to fit a dense row. Pad the row, never the target.
Contrast
Every text token is checked on the surface it's meant for. Body text needs 4.5:1; large text, icons and redundant meta text need 3:1.
Contrast checker
Choose a text token and a surface. Translucent fills are flattened onto the page first.
on
light
Your site is liveVisitors can read docs.acme.dev from anywhere.
5.92:1Large textAAAAA
dark
Your site is liveVisitors can read docs.acme.dev from anywhere.
8.89:1Large textAAAAA
| Text on surface | Role | Needs | Light | Dark |
|---|---|---|---|---|
| text-foreground on bg-background | Body text | 4.5:1 | 16.29 | 15.88 |
| text-muted-foreground on bg-background | Secondary text | 4.5:1 | 5.92 | 8.89 |
| text-subtle-foreground on bg-background | Placeholders, meta (large or redundant) | 3:1 | 5.92 | 8.89 |
| text-primary on bg-background | Links, active icons | 4.5:1 | 4.70 | 11.04 |
| text-card-foreground on bg-card | Text on cards | 4.5:1 | 16.29 | 15.88 |
| text-popover-foreground on bg-popover | Menu items | 4.5:1 | 16.29 | 15.15 |
| text-foreground on bg-accent | Hovered rows and items | 4.5:1 | 14.30 | 13.21 |
| text-primary-foreground on bg-primary | Text on the brand fill | 4.5:1 | 4.51 | 11.87 |
| text-danger on bg-background | Error text | 4.5:1 | 5.21 | 7.45 |
| text-danger on bg-danger-surface | Error text in a Note | 4.5:1 | 4.94 | 7.32 |
| text-warning on bg-warning-surface | Warning text in a Note | 4.5:1 | 4.43 | 11.52 |
| text-success on bg-success-surface | Success text in a Note | 4.5:1 | 4.49 | 10.61 |
| text-info on bg-info-surface | Info text in a Note | 4.5:1 | 4.53 | 8.38 |
Focus
One ring for every control, visible whenever the keyboard is in use.
Try it
Click a control, then press Tab and Shift+Tab. The ring shows for the keyboard, not the mouse.
Pinned on
border-focus plus a 3px ring-focus/50, the same on every control.
Targets
Dense rows pad the hit area; they don't shrink the control.
Hit areas
32px minimum, never narrower than square, 8px between neighbours.
32 × 32
32 × 32
36 × 36
32 × 54
Rules
Every rule on one list. Open one for the reasoning behind it.
8 rules
01Contrast is checked against the surface the text sits on
Body and label text meet WCAG AA (4.5:1). Large text and icons meet 3:1. Subtle text is reserved for placeholders, timestamps and counts, where the primary value is also shown another way.02Everything works from the keyboard
Tab reaches every control in reading order. Enter and Space activate, Escape closes, arrows move within a list, menu or segmented control. Dialogs trap focus and return it to the trigger on close.03Focus is visible and the same everywhere
Controls use the shared focus-visible ring (border-focusplus a 3pxring-focus/50). Never remove the outline without replacing it. Mouse clicks don't show the ring; keyboard focus always does.04Targets are at least 32px, with 8px between them
Buttons are never narrower than square (min-w-*matches the height). Icon-only buttons usesize="icon",iconSmoriconXs, which are exactly square (size-*, nomin-w-*, so asize-*override inclassNameresizes both sides), and dense rows add padding to the clickable area rather than shrinking it.05Status is never carried by color alone
A status always has a label or an icon next to its hue:StatusBadgepairs the dot with text,Notepairs the tint with an icon, charts carry legends. Red, amber and green are reinforcement, not the message.06Icon-only controls have an accessible name
Every icon button getsaria-label. Decorative icons next to a label arearia-hidden. Tooltips repeat the label for sighted users and are never the only name.07Motion has a reduced-motion state
Underprefers-reduced-motion, transitions are shortened and non-essential movement stops. Each state (loading, selected, open) still reads without the animation.08Live changes are announced
Toasts, save confirmations and streaming text usearia-live="polite". Errors tied to a field setaria-invalidandaria-describedbyto the message.