Skip to content

Implement a11y-no-aria-label-misuse linter rule#1677

Open
joelhawksley wants to merge 1 commit intomarcoroth:mainfrom
joelhawksley:1223
Open

Implement a11y-no-aria-label-misuse linter rule#1677
joelhawksley wants to merge 1 commit intomarcoroth:mainfrom
joelhawksley:1223

Conversation

@joelhawksley
Copy link
Copy Markdown
Contributor

Implements the a11y-no-aria-label-misuse rule from erblint-github's NoAriaLabelMisuse.

This rule flags misuse of aria-label and aria-labelledby attributes on elements where they are not reliably supported:

  • Always flags on name-restricted elements: h1h6, strong, i, p, b, code
  • Flags on generic elements (div, span) without a role attribute
  • Flags on generic elements with a prohibited role (none, presentation, paragraph, etc. per W3C namefromprohibited)
  • Allows usage on interactive elements (button, a, input, etc.)
  • Allows usage on generic elements with a permitted role (dialog, alert, etc.)

Closes #1223

Implements the `a11y-no-aria-label-misuse` rule from erblint-github's
`NoAriaLabelMisuse`.

This rule flags misuse of `aria-label` and `aria-labelledby` attributes
on elements where they are not reliably supported:

- Always flags on name-restricted elements: h1-h6, strong, i, p, b, code
- Flags on generic elements (div, span) without a role attribute
- Flags on generic elements with a prohibited role (none, presentation,
  paragraph, etc. per W3C namefromprohibited)
- Allows usage on interactive elements (button, a, input, etc.)
- Allows usage on generic elements with a permitted role (dialog,
  alert, etc.)

Closes marcoroth#1223
@github-actions github-actions Bot added documentation Improvements or additions to documentation linter typescript a11y linter-rule labels Apr 23, 2026
@joelhawksley joelhawksley marked this pull request as ready for review April 23, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a11y documentation Improvements or additions to documentation linter linter-rule typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linter: Implement a11y-no-aria-label-misuse rule

1 participant