frontend-accessibility-best-practices_skill

This skill helps you implement accessibility best practices in React components, improving semantic structure, keyboard support, and screen reader experience.

68

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill sergiodxa/agent-skills --skill frontend-accessibility-best-practices

  • SKILL.md4.0 KB

Overview

This skill provides concise accessibility (a11y) best practices for building inclusive React components following WCAG guidance. It bundles rules across semantic HTML, screen reader support, keyboard & focus behavior, and user preference handling. Use it to design, implement, or review UI components, forms, and interactive patterns for real-world apps.

How this skill works

The skill inspects common component patterns and recommends concrete fixes and examples: prefer semantic HTML landmarks, add screen-reader-only labels, use ARIA live regions for dynamic updates, ensure keyboard operability and visible focus, and honor user motion preferences. It points to practical implementations such as accessible buttons, focus-trapped modals, reduced-motion fallbacks, and appropriate touch target sizing.

When to use it

  • Creating new UI components or layout regions
  • Building or validating forms and form fields
  • Adding interactive controls, buttons, or menus
  • Implementing dynamic updates or notification content
  • Reviewing code for accessibility regressions

Best practices

  • Use semantic HTML (header, nav, main, footer, h1–h6, landmarks) instead of divs for structure and landmarks
  • Provide accessible names for icon-only controls using visually hidden text (sr-only) or aria-label
  • Announce dynamic content with role="alert" or aria-live="polite" as appropriate
  • Prefer native controls (button, a, input) for built-in keyboard support; avoid click-only divs
  • Show visible focus indicators and trap focus in modal dialogs; ensure focus order is logical
  • Respect prefers-reduced-motion and ensure touch targets are at least 44x44px

Example use cases

  • Turning a div-based header/nav into semantic <header> and <nav aria-label> landmarks
  • Making icon-only close buttons accessible with an sr-only label and aria-hidden icons
  • Wrapping status updates in a role="status" region so screen readers announce result counts
  • Replacing clickable divs with <button> or react-aria Button for keyboard activation
  • Using a reduced-motion hook to skip animations for users who prefer less motion

FAQ

Use role="alert" for important error messages that need immediate announcement. Use aria-live="polite" for non-critical status updates like result counts to avoid interrupting the user.

How do I handle focus when opening a modal?

Set initial focus to a meaningful element inside the modal, trap focus within the dialog, and restore focus to the element that opened it. Use libraries like react-aria or a modal component that manages focus automatically when possible.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
frontend-accessibility-best-practices skill by sergiodxa/agent-skills | VeilStrat