jsx-a11y plugin to help you build interfaces that work for everyone.
Why Accessibility Matters
- 15% of the world has some form of disability
- Legal requirement in many jurisdictions (ADA, Section 508, WCAG)
- Better UX for everyone (keyboard nav, screen readers, low vision)
- SEO benefits from semantic HTML
Rules
alt-text
alt-text
Severity: error
Rule ID:Good:
Rule ID:
jsx-a11y/alt-textRequires alt attribute on <img> elements. Screen readers use alt text to describe images.Bad:anchor-is-valid
anchor-is-valid
Severity: warn
Rule ID:Good:
Rule ID:
jsx-a11y/anchor-is-validEnsures <a> elements have valid href attributes. Links without hrefs should be buttons.Bad:click-events-have-key-events
click-events-have-key-events
Severity: warn
Rule ID:Good:
Rule ID:
jsx-a11y/click-events-have-key-eventsRequires keyboard event handlers alongside click handlers for accessibility.Bad:no-static-element-interactions
no-static-element-interactions
Severity: warn
Rule ID:Good:
Rule ID:
jsx-a11y/no-static-element-interactionsPrevents adding click/keyboard handlers to non-interactive elements without proper ARIA roles.Bad:no-noninteractive-element-interactions
no-noninteractive-element-interactions
Severity: warn
Rule ID:Good:
Rule ID:
jsx-a11y/no-noninteractive-element-interactionsPrevents adding interactions to non-interactive elements like <li>, <article>, etc.Bad:role-has-required-aria-props
role-has-required-aria-props
Severity: error
Rule ID:Good:
Rule ID:
jsx-a11y/role-has-required-aria-propsEnsures ARIA roles have all required ARIA attributes.Bad:no-autofocus
no-autofocus
Severity: warn
Rule ID:Good:
Rule ID:
jsx-a11y/no-autofocusDiscourages autoFocus as it can be disorienting for screen reader users.Bad:heading-has-content
heading-has-content
Severity: warn
Rule ID:Good:
Rule ID:
jsx-a11y/heading-has-contentRequires heading elements to have content for screen readers.Bad:html-has-lang
html-has-lang
Severity: warn
Rule ID:Good:
Rule ID:
jsx-a11y/html-has-langRequires <html> element to have lang attribute for screen readers.Bad:no-redundant-roles
no-redundant-roles
Severity: warn
Rule ID:Good:
Rule ID:
jsx-a11y/no-redundant-rolesPrevents specifying redundant ARIA roles that are implicit.Bad:scope
scope
Severity: warn
Rule ID:Good:
Rule ID:
jsx-a11y/scopeEnsures scope attribute is only used on <th> elements in tables.Bad:tabindex-no-positive
tabindex-no-positive
Severity: warn
Rule ID:Good:
Rule ID:
jsx-a11y/tabindex-no-positivePrevents positive tabIndex values which disrupt natural tab order.Bad:label-has-associated-control
label-has-associated-control
Severity: warn
Rule ID:Good:
Rule ID:
jsx-a11y/label-has-associated-controlRequires <label> elements to be associated with form controls.Bad:no-distracting-elements
no-distracting-elements
Severity: error
Rule ID:Good:
Rule ID:
jsx-a11y/no-distracting-elementsPrevents using distracting elements like <marquee> and <blink>.Bad:iframe-has-title
iframe-has-title
Severity: warn
Rule ID:Good:
Rule ID:
jsx-a11y/iframe-has-titleRequires <iframe> elements to have a title attribute.Bad:Accessibility Best Practices
Semantic HTML
Use the right element for the job:Keyboard Navigation
Ensure all interactive elements are keyboard accessible:- Use semantic HTML (
<button>,<a>,<input>) - Add
tabIndex={0}for custom interactive elements - Handle
EnterandSpacekeys for custom controls - Provide visible focus indicators
Screen Readers
Make content accessible to screen readers:- Use
alttext for images - Label form inputs
- Use ARIA labels when needed:
aria-label,aria-labelledby - Provide
aria-liveregions for dynamic content - Use proper heading hierarchy (
h1→h2→h3)
Color and Contrast
- Maintain 4.5:1 contrast ratio for text
- Don’t rely on color alone to convey information
- Test with color blindness simulators
Testing Tools
- axe DevTools - Browser extension
- WAVE - Web accessibility evaluation tool
- Lighthouse - Built into Chrome DevTools
- NVDA - Free screen reader for Windows
- VoiceOver - Built into macOS
Related Rules
- Correctness Rules - Common React mistakes
- Next.js Rules - Next.js-specific patterns