What does this skill do?

The Frontend Accessibility Patterns Skill provides practical accessibility (a11y) patterns for React and Next.js, addressing common issues such as disconnected form labels, incorrect use of ARIA attributes, and faulty keyboard navigation. It prioritizes native HTML semantics, logical focus management, and respect for user preferences to create interfaces that are operable and understandable for everyone.

Accessible Forms
Link labels, fields, and error messages using `label`, `aria-describedby`, and `role="alert"`.
Focus Management in Modals
Move the focus to the inside of the modal when it opens, and return it to the calling element when it closes.
Keyboard Navigation
Verify that all interactive elements are accessible using the Tab, Enter, Space, and arrow keys.
ARIA with Discretion
Apply ARIA attributes only when native HTML is not sufficient for screen readers.

Usage examples

📝 Form with errors
Create an accessible email field that displays an error message announced by the screen reader.
🪟 Modal with a focus trap
Implement an accessible modal that moves the focus when opened and restores it when closed, with the Escape key used to close it.
🔘 Icon button
Make a button that contains only a trash can icon accessible to screen readers.
⌨️ Keyboard Navigation
Check this drop-down menu and make sure it can be navigated using the arrow keys and the Escape key.

Features

Native HTML Semantics Prioritize the use of proper native elements over `div`s with `onClick` to ensure accessibility.
Tag Connections and Errors Associate labels with htmlFor/id and link error messages with aria-describedby and role="alert".
Predictable Focus Management It shifts and restores focus to dialog boxes and menus for intuitive keyboard navigation.
ARIA Applied judiciously Use ARIA attributes only when native HTML is not sufficient, to avoid creating incorrect expectations.
Respects "prefers-reduced-motion" Disables or reduces animations based on the user's operating system settings.

Frequently asked questions

Accessibility patterns apply to any framework, but the code examples are written in React and Next.js using TypeScript.
For a full-featured focus trap in Modals, libraries such as focus-trap-react are recommended, but the basic patterns use native HTML and ARIA without any dependencies.
No. This skill helps you write accessible code from the start; auditing tools are still necessary for validation.
Yes. Describe the problematic component or the ESLint/Lighthouse warnings, and Claude will apply the corrective patterns.
Frontend Accessibility Patterns — Accessible Interfaces in React with Claude AI

¿Prefieres escuchar el contenido? Genera la narración de audio con un clic.