Skip to content

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

Merged
marcoroth merged 11 commits into
marcoroth:mainfrom
joelhawksley:1223
Jun 7, 2026
Merged

Linter: Implement a11y-no-aria-label-misuse rule#1677
marcoroth merged 11 commits into
marcoroth:mainfrom
joelhawksley:1223

Conversation

@joelhawksley

@joelhawksley joelhawksley commented Apr 23, 2026

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, em, 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.)

Resolves #1223
Closes #1593

@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
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
@marcoroth marcoroth changed the title Implement a11y-no-aria-label-misuse linter rule Linter: Implement a11y-no-aria-label-misuse rule May 22, 2026
Comment thread javascript/packages/linter/src/rules/a11y-no-aria-label-misuse.ts Outdated
@marcoroth marcoroth merged commit 17ffac1 into marcoroth:main Jun 7, 2026
12 checks passed
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

2 participants