Accessibility
How Zenos preserves semantics and how consumers complete them.
Accessibility is part of the component contract and the product workflow. Zenos provides a reliable foundation, while the consuming application supplies the context that a component library cannot know.
Responsibility model
Section titled “Responsibility model”Native HTML → semantic foundationBase UI → complex keyboard, focus, and ARIA behaviorZenos → preserves and composes those semanticsConsumer → supplies meaningful labels, content, and workflowsWhat Zenos provides
Section titled “What Zenos provides”- Native controls where the browser already provides the correct semantics.
- Base UI behavior for dialogs, menus, selection controls, tabs, and anchored overlays.
- Forwarded refs, native props, event handlers,
aria-*, anddata-*attributes. - Keyboard navigation, focus management, Escape handling, and focus return where applicable.
- Visible focus treatment and semantic
disabled,invalid, andrequiredstates. - Field relationships between labels, controls, descriptions, and errors.
- Reduced-motion behavior for transitions and animation.
- Semantic tokens that support readable light and dark themes.
Consumer responsibilities
Section titled “Consumer responsibilities”Name controls Give icon-only actions, landmarks, forms, and navigation regions concise accessible names.
Write useful content Provide meaningful headings, dialog titles, instructions, status messages, and actionable errors.
Preserve focus Keep a logical order, return focus after overlays close, and never remove an outline without an equivalent.
Test the workflow Validate complete tasks with keyboard, zoom, assistive technology, real content, and application state.
Start with native semantics
Section titled “Start with native semantics”Use a button for actions and an anchor for navigation. Keep heading levels meaningful. Use lists, tables, labels, and landmarks for their intended purpose.
Zenos polymorphism does not make every element interchangeable. When using as, preserve the semantic role and required native behavior of the resulting element.
Labels, descriptions, and errors
Section titled “Labels, descriptions, and errors”Use Field to establish form relationships:
<Field.Root required invalid={hasError}> <Field.Label>Email</Field.Label> <Field.Control> <Input name="email" autoComplete="email" /> </Field.Control> <Field.Description>Used for security notifications.</Field.Description> <Field.Error>Enter a valid email address.</Field.Error></Field.Root>A placeholder is not a label. Error text should explain how to recover, and invalid state should not rely on color alone.
Keyboard interaction
Section titled “Keyboard interaction”Native controls and Base UI primitives provide their established keyboard patterns. Consumers should not replace those handlers unless the product requires a different documented interaction.
Verify at minimum:
TabandShift+Tabmove through controls in a logical order.EnterandSpaceactivate the expected controls.Escapecloses temporary surfaces without closing unrelated parents.- Arrow keys, Home, and End work where the component pattern defines them.
- Disabled controls are skipped or announced according to their semantics.
Focus management
Section titled “Focus management”Focus must remain visible in light and dark themes. Dialogs and modal sheets contain focus while open and return it to a sensible trigger when closed. Popovers and menus should not leave focus on removed content.
Composition through Base UI’s render prop must preserve the supplied props, ref, event handlers, and ARIA attributes on the rendered element.
Content and visual design
Section titled “Content and visual design”- Maintain sufficient contrast for text, icons, borders, and focus rings.
- Do not communicate status with color alone.
- Allow labels, descriptions, and errors to wrap.
- Keep controls reachable at 200% browser zoom.
- Respect
prefers-reduced-motionand avoid essential information in animation. - Test right-to-left content and logical navigation where direction matters.
- Provide text alternatives for meaningful images; use empty alt text for decoration.
Dynamic content
Section titled “Dynamic content”Announce important asynchronous results with an appropriate live region, but avoid narrating every intermediate update. Loading indicators need nearby context when the outcome is not otherwise clear.
Move focus only when it helps the user continue the task. Validation should normally preserve focus and connect the control to its error instead of jumping unexpectedly.
Testing strategy
Section titled “Testing strategy”Zenos uses several layers because no single tool can verify accessibility:
| Layer | Purpose |
|---|---|
| Vitest and Testing Library | Roles, accessible names, state, relationships, and component contracts |
| Playwright | Browser keyboard behavior, focus movement, portals, and complete consumer flows |
| axe | Common automated WCAG failures on representative rendered pages |
| Manual review | Screen readers, zoom, contrast, motion, RTL, long content, and task comprehension |
Use accessible queries such as getByRole in tests. They validate the public experience and remain more stable than classes or private selectors.
Manual checklist
Section titled “Manual checklist”- Complete the flow with keyboard only.
- Verify Tab, Shift+Tab, Enter, Space, Escape, arrows, Home, and End where relevant.
- Confirm focus is always visible and returns after an overlay closes.
- Test at 200% zoom and with large system text.
- Enable reduced motion, dark mode, and RTL.
- Review labels, descriptions, status messages, and errors with a screen reader.
- Test empty, loading, invalid, disabled, and long-content states.
- Confirm touch targets remain usable on a narrow viewport.
Automated checks find common failures; they do not certify an experience or replace testing with disabled users and assistive technology.