aria-unsupported-elements
aria-unsupported-elements rule
Keywords: aria-unsupported-elements, accessibility, ESLint rule, WCAG, a11y, React accessibility
Prevent ARIA on unsupported elements. This rule is part of eslint-plugin-react-a11y and provides LLM-optimized error messages with fix suggestions.
Quick Summary
| Aspect | Details |
|---|---|
| WCAG Criterion | 4.1.1 Parsing |
| Severity | Error/Warning (accessibility) |
| Auto-Fix | 💡 Suggestions available |
| Category | Accessibility |
| ESLint MCP | ✅ Optimized for ESLint MCP integration |
Rule Details
This rule helps ensure WCAG 4.1.1 compliance by enforcing: Prevent ARIA on unsupported elements
Why This Matters
| Issue | Impact | Standard |
|---|---|---|
| ♿ Accessibility | Screen reader and assistive technology users affected | WCAG 4.1.1 |
| ⚖️ Legal | ADA/Section 508 compliance risk | Legal Requirement |
| 🔍 SEO | Search engines prefer accessible sites | Best Practice |
Examples
❌ Incorrect
// Violation of aria-unsupported-elements
// See rule source for specific examples✅ Correct
// Compliant with aria-unsupported-elements
// See rule source for specific examplesConfiguration
// eslint.config.js
{
rules: {
'react-a11y/aria-unsupported-elements': 'error'
}
}WCAG 2.1 Compliance
This rule helps satisfy:
- 4.1.1 Parsing: Prevent ARIA on unsupported elements
Related Rules
- See RULES.md for all accessibility rules
Further Reading
- WCAG 4.1.1 - WCAG guidelines
- WebAIM - Accessibility resources
- MDN Accessibility - MDN documentation
Version
This rule is available in eslint-plugin-react-a11y v1.0.0+
Known False Negatives
The following patterns are not detected due to static analysis limitations:
Dynamic Variable References
Why: Static analysis cannot trace values stored in variables or passed through function parameters.
// ❌ NOT DETECTED - Prop from variable
const propValue = computedValue;
<Component prop={propValue} /> // Computation not analyzedMitigation: Implement runtime validation and review code manually. Consider using TypeScript branded types for validated inputs.
Imported Values
Why: When values come from imports, the rule cannot analyze their origin or construction.
// ❌ NOT DETECTED - Value from import
import { getValue } from './helpers';
processValue(getValue()); // Cross-file not trackedMitigation: Ensure imported values follow the same constraints. Use TypeScript for type safety.