Accessibility
What the system guarantees, what you must still provide, and how to test that a screen works for everyone.
Silkware builds on React Aria, which implements the keyboard, focus and screen reader behaviour of each pattern, and on a theme whose colour pairs are checked by script. That covers the hard parts. It does not cover the content: a label, a name for an icon button, an error that says what to change. Those are yours, and most accessibility defects in a finished screen are there.
The baseline is WCAG 2.2 level AA. This page says what you get for free, what you owe, and how to check.
What React Aria gives every component
Every interactive component in components/ui that is built on React Aria inherits these, without any code from you.
- Keyboard. Each pattern follows its keyboard model: arrow keys in tabs, menus, radio groups, listboxes and tables, Escape to close overlays, Enter and Space to press. The tables on each component page list the keys.
- Focus management. Overlays take focus when they open. Dialogs, selects and menus return it to the trigger on close. Disabled items are removed from keyboard navigation.
- Roles and ARIA. Components render the right role and set
aria-expanded,aria-selected,aria-checked,aria-invalidand the labelling attributes from the props you pass. - Press events that work everywhere.
onPressbehaves the same for mouse, touch, pen, keyboard and screen reader activation, so no handler waits for a click that a screen reader sends differently. - Touch and pointer. Hover effects apply to a real pointer only, so a tap does not leave a stuck hover state.
- Overlays that block what is behind them. A modal blocks interaction with everything outside it.
Read the "Accessibility" section of each component page for the exact keys and for what that component leaves to you. Components that come from Base UI (Drawer, Navigation Menu, Menubar) have their own primitive's behaviour; their pages say so.
What the theme guarantees
- Contrast.
pnpm check:contrastresolves every token pair inapp/globals.cssin light and dark and fails if text is under 4.5:1, or if focus rings, borders and marks are under 3:1. It currently passes 229 pairs, including the edge of form controls on every surface, the status colours and the syntax colours of code. Run it after you change a token or a client theme, and after you use a token pair that is not already declared. - Visible focus. Components show a focus ring on keyboard focus (
focus-visible), made of a full-strength--ringborder and a half-strength ring around it. Bare links get a 2px outline in--ring. Do not remove an outline; if a focus ring is clipped, give the container padding instead. - Reduced motion. When the person prefers reduced motion,
app/globals.csscuts every animation and transition to near zero and turns off smooth scrolling. Do not rely on motion to carry meaning, and do not add JavaScript animation that ignoresprefers-reduced-motion. - State is not colour. Silkware has a green, an amber and a blue for success, warning and information, and each holds 4.5:1 as text. They are never the only signal: a status always has a word, and an icon beside it. The state square carries where an item stands in its flow, with a word. Both survive greyscale, colour blindness and forced colours.
- Language. Text in Simplified Chinese takes its own font, line height and no letter spacing when the element has
lang="zh"(lang="zh-Hans"also matches). Setlangon the document and on any passage in another language.
What you must still provide
| You must | Because | How |
|---|---|---|
| Label every control | A placeholder is not a label and disappears while typing. | Put the control in a Field with a visible Label, or pass aria-label where a visible label is impossible. |
| Name every icon-only button | Without text, a screen reader says "button". | aria-label on the Button. A tooltip is a bonus for sighted people, not the name. |
| Tie help and error text to its field | Text that is not associated is not read when the field is focused. FieldDescription and FieldError are not linked for you. | Give each an id and list the ids in aria-describedby: on the input, or on the React Aria component for Select, Combobox, Radio Group, Checkbox Group and Slider. Add aria-invalid on an input or isInvalid on the component. The Field page has the table. |
| Say what is wrong in words | A red border alone fails people who do not see red. | Write the error text; see UX writing. |
| Use headings and landmarks | Screen reader users jump by heading and landmark. | One h1 per page, headings in order without skipping, nav, main and aside for the regions, aria-label when there are two of a kind. |
| Never use colour alone | See above. | Add a word, a shape or a position. |
| Keep targets big enough | Fingers are not pointers. | See Target size. |
| Describe images | A picture says nothing to a screen reader. | alt that says what the picture shows for the task, and alt="" when it only decorates. |
| Set the language | Screen readers pick a voice from it. | lang on the html element and on passages in another language. |
| Make the focus order the reading order | Keyboard and screen reader users follow the code. | Do not reorder regions with CSS in a way that separates the visual order from the source order. |
| Give an overlay a title | An unnamed dialog is announced as "dialog". | Use the title part of the Dialog, Alert Dialog or Sheet. |
| Give the person time | A message that vanishes is missed. | Set a longer duration on a toast that holds a sentence; never put the only copy of an error in a toast. |
Name an icon button with aria-label, and add a tooltip for people who hover.
Don’t leave an icon button without a name. A screen reader announces only that it is a button.
Giulia receives the order confirmation here.
Write the error as text, tie it to the field with aria-describedby and mark the field aria-invalid.
Don’t mark an error with a red border alone. Nothing says what is wrong, and some people cannot see the colour.
Keyboard patterns
These keys work in Silkware components. Where a component differs, its page says so.
| Key | Action |
|---|---|
| Tab | Moves focus to the next control. Disabled controls are skipped. |
| ShiftTab | Moves focus to the previous control. |
| Enter | Presses a button or follows a link. |
| Space | Presses a button, toggles a checkbox or a switch, and selects a radio button. |
| ArrowDown | Opens a select, a combobox or a menu, and moves to the next option inside one. |
| ArrowLeft | Moves to the previous tab in a horizontal list, or the previous radio button in a group. |
| ArrowRight | Moves to the next tab in a horizontal list, or the next radio button in a group. |
| Home | Moves to the first tab or option. |
| End | Moves to the last tab or option. |
| Esc | Closes the open overlay, such as a dialog, sheet, menu or list, and returns focus to its trigger. |
| CtrlB | Opens or closes the sidebar. Command B on a Mac. |
Two details to keep in mind. In a tab list, arrow keys move focus and, by default, select the tab as well; set keyboardActivation="manual" on tabs whose panels are slow to load. Tabs, radio groups, menus and listboxes are a single tab stop: Tab enters the group and leaves it, and the arrow keys move inside.
Target size
WCAG 2.2 asks for targets of at least 24 by 24 CSS pixels at level AA (2.5.8), or enough space around a smaller one, and for 44 by 44 at the stricter level AAA (2.5.5). The Silkware brand asks for 44px where a finger is the pointer. The shipped sizes meet AA on every device; a touch-controls scope raises a screen or a region to 44.
| Control | As shipped, every device | Inside a touch-controls scope |
|---|---|---|
| Button, Input, Select trigger | 36px high (h-9) | 44px high |
Button sm | 32px | 44px |
Button xs and icon-xs | 24px | 44px, or a 44px hit area inside an input group |
| Checkbox, Radio, Switch | 16px, 16px and about 32 by 18px, each with a hit area extended by 12px on the sides and 8px above and below | Same look, hit area 44px, and the row is 44px |
| Dialog and sheet close icon | 32px | Same look, hit area 44px |
| Calendar day | 32px | 44px |
- Apply
touch-controlswhere a screen is meant for fingers, with the condition that fits:pointer-coarse:touch-controlson a screen used with a mouse and on phones. See Sizing. - As shipped, every control passes the AA minimum of 24px; axe checks it on every page. Use the default size for anything a person presses often, and keep
xsfor dense tables. - Keep 8px between adjacent small targets. Inside a scope the controls are 44px and need no gap.
- Inline links in a sentence are exempt from both levels and keep the height of the text.
- The size is the
--touch-targettoken. A client theme can raise it to 48px (3rem); it should not go below 44px for the Silkware brand. tests/smoke.mjsruns axe's target-size rule on every page and, with a touch screen, fails on any target under the token inside a scope, apart from a short list with reasons.
How to test
Test every screen you ship with the three passes below. The first two take five minutes.
Keyboard pass
Unplug the mouse. Press Tab from the top of the page and go through every control.
- Can you reach everything that you can click, in the order you read it?
- Can you always see where focus is?
- Does Escape close each overlay, and does focus return to what opened it?
- Is there any place where focus gets stuck, or disappears?
Screen reader pass
Turn on VoiceOver (macOS, Command F5) or NVDA (Windows) and go through the main task with the screen turned away.
- Is every control announced with a name and a role?
- Is every error read when you reach its field?
- Are the headings, in order, a usable outline of the page?
- Does anything that changes on the page, such as a toast or a result, get announced?
Zoom and preferences pass
Zoom the page to 200 percent and to 400 percent, set the browser's text size larger, and switch on reduced motion.
- Does the layout reflow to a single column without horizontal scroll?
- Is anything cut off or hidden at a large text size?
- Does anything still move with reduced motion on?
Then run the automated checks of this repository.
| Check | What it catches |
|---|---|
pnpm check:contrast | Colour pairs under 4.5:1 for text or 3:1 for focus rings, borders and marks, in light and dark. |
pnpm lint | The Next.js lint rules. It includes some accessibility rules for JSX, such as images without alt. |
pnpm typecheck | Props that components require, for example a missing children. |
node scripts/screenshot.mjs <path> <file.png> --dark --width 375 | Console errors and horizontal overflow, in dark and at phone width. Look at the PNG as well. |
Automated tools find only part of the problems. They cannot tell whether a label is a good label or an error says the right thing. The two manual passes are not optional.
Known limits
These are things the system does not solve, so you can plan for them.
- Target size outside a scope. Controls are 36px by default and 24px at
xson every device unless a screen opts in withtouch-controls: AA, not the brand’s 44px or the AAA target. A screen a person uses by finger needs the class. - Small crimson text on dark. The theme replaces the brand crimson with a lighter tint for error text in dark mode, because the brand's crimson on ink is about 4.0:1. The crimson state square on a dark page is 4.03:1, which passes the 3:1 rule for marks but is not text. Do not set text in
--brandon a dark ground. - Tooltips on touch. React Aria documents that tooltips are not shown on touch screen interactions. Never put information a person needs in a tooltip.
- Components from other primitives. Drawer, Navigation Menu and Menubar use Base UI, and Toast uses Sonner. They follow their own libraries' keyboard and screen reader behaviour, which may differ in detail from the React Aria components. Test them in your product.
- Charts. A chart drawn with
rechartsis a picture to a screen reader. Always put the numbers in a table or a sentence beside it. - Agent output. Streaming text and agent steps change while a person reads. Announcing each change would be noisy, so test how your own screen announces progress and results, and make sure the final result and any approval request are reachable by keyboard.
- No automated browser test yet. The repository has
@axe-core/playwrightinstalled, but the browser accessibility suite described in the design spec is not in the repository at the time of writing. Until it is, the manual passes above are the main check. - Not audited with real users. The system follows the patterns of its primitives and passes its own contrast check. It has not been tested with assistive technology users. Do that in your product.