Accessibility
@codeui/solid v0.3.0
What the kit guarantees for keyboard, screen readers, and focus, and what stays your job.
Kit components are built on Kobalte, which implements the WAI-ARIA patterns for each widget. The kit adds the styles, the focus ring and the defaults. This page lists what the kit commits to, where it falls short today, and what stays your job.
The Kobalte engine
Kobalte renders the roles and ARIA attributes, manages focus and handles the keyboard. For example, Select renders a trigger button and a listbox of option elements, and Dialog keeps focus inside itself and takes its accessible name from its title. The kit does not reimplement this behavior.
Each component page records what Kobalte gives that component:
- a keyboard map with the columns Key and Action;
- the roles and ARIA attributes it renders;
- where focus goes when it opens and when it closes.
Kobalte also fixes behavior the kit relies on. Closing an overlay returns focus to its trigger. Escape closes only the top layer.
Keyboard
import { Button, Switch, TextField } from "@codeui/solid";
export default function FocusRing() {
return (
<>
<TextField size="sm" label="Snippet name" placeholder="Untitled" />
<Switch label="Show line numbers" />
<Button variant="primary" size="sm">
Export PNG
</Button>
</>
);
}Press Tab to move through the field, the switch and the button. Every kit control works from the keyboard. Pickers and cards open with Enter and Space. Arrow keys move inside lists, menus, tabs, radio groups and segmented controls.
Motion follows the keyboard rule in Motion. Accordion, Sheet and Command menu do not animate when the keyboard opens them.
Focus ring
Kit controls draw one ring:
| Token | Value |
|---|---|
--cui-focus-color | var(--cui-accent-focus). #63b3ed dark, #0068b9 light. |
--cui-focus-width | 2px |
--cui-focus-offset | 2px |
The ring is an outline on :focus-visible. A mouse click does not show it, and a key press does. Override --cui-accent-focus to recolor it everywhere. Do not remove the outline in your own CSS without drawing another ring.
Text fields mark focus differently today. The field border takes --cui-focus-color on :focus, without the 2px ring.
Hit targets
| Pointer | Smallest target |
|---|---|
| Mouse or trackpad | 28px |
| Touch | 40px |
Controls default to sm, which gives a 36px target at comfortable density and 40px at touch density. Choose a larger size when a control needs a larger target.
Accordion headers and option cards grow under (pointer: coarse). Other components keep the size you pick, so on a touch layout pick md or larger. A small mark, such as a close icon, keeps a hit box of at least 24px.
Text size
No kit text is smaller than --cui-font-size-badge (11px). Keep your own interface text at 11px or more. Phone inputs use 16px, so iOS does not zoom into the field. The Command menu input does this already.
Contrast
import { Button } from "@codeui/solid";
export default function Contrast() {
return (
<>
<Button variant="primary">Export PNG</Button>
<Button variant="negative">Delete snippet</Button>
<Button variant="secondary">Copy snippet</Button>
</>
);
}Inkstone asks for 4.5:1 for text up to 18px, and 3:1 for large text, icons, rings and control edges, in both themes. These pairs were measured from the token values:
| Pair | Dark | Light |
|---|---|---|
text.default on surface.canvas | 16.7:1 | 15.1:1 |
text.muted on surface.canvas | 8.1:1 | 6.8:1 |
text.hint on surface.input | 6.3:1 | 6.2:1 |
action.neutral.text on action.neutral.base | 12.9:1 | 12.4:1 |
action.danger.text on action.danger.base | 5.5:1 | 5.5:1 |
action.caution.text on action.caution.base | 8.5:1 | 8.5:1 |
action.success.text on action.success.base | 8.7:1 | 8.7:1 |
text.danger on surface.canvas | 7.7:1 | 4.8:1 |
accent.focus ring on surface.canvas | 8.3:1 | 5.1:1 |
surface.track (switch off) on surface.panel | 2.2:1 | 3.2:1 |
action.brand.text on action.brand.base | 4.7:1 | 4.7:1 |
action.brandSoft.text on surface.panel | 7.5:1 | 8.0:1 |
The shared brand fill is #0076cf in both themes. Hover uses #0068b9 and active uses #004f8e. White labels reach 4.7:1, 5.7:1, and 8.4:1 in those states. The focus ring uses --cui-accent-focus, #63b3ed in dark mode and #0068b9 in light mode. Links and labels on the 15% wash use --cui-action-brand-soft-text, #63b3ed in dark mode and #004f8e in light mode.
The switch off track stays below 3:1 on some surfaces. The thumb position and the blue on track also indicate state.
pnpm --filter @codeui/solid test checks the light pairs: packages/kit/test/light-palette.test.ts fails when a light text, ring or edge token drops below its target.
Check contrast again whenever you override a color token. The kit cannot check your values.
Accessible names
import { IconButton, Tooltip } from "@codeui/solid";
export default function AccessibleNames() {
return (
<Tooltip content="Copy snippet">
<IconButton variant="secondary" aria-label="Copy snippet">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
<rect x="8" y="8" width="12" height="12" rx="2" />
<path d="M16 8V4H4v12h4" />
</svg>
</IconButton>
</Tooltip>
);
}IconButton requires aria-label in its type, so TypeScript rejects an icon button without a name. Wrap it in a Tooltip with the same text, so sighted users get the name too.
Fields take a label. If a design has no visible label, pass aria-label. Never use a placeholder as the only label.
Reduced motion
Under prefers-reduced-motion: reduce, kit overlays fade instead of moving, and loops stop. Motion lists each component.
What stays your job
- Give every field, icon button and landmark a name.
- Keep color from being the only signal. Pair an error color with an icon or text.
- Check contrast for every token you override.
- Pick touch sizes on touch layouts.
- Keep page structure in order: one
h1, headings without skipped levels, and alangattribute on<html>. - Test in Chrome, Firefox and Safari, with the keyboard and a screen reader.
Maintainers verify each component with the steps in Verify accessibility and SSR. The rules behind this page are in Inkstone, section 10 of packages/kit/DESIGN.md.