Skip to content

Linter: Implement a11y-svg-has-accessible-text rule#1669

Open
joelhawksley wants to merge 9 commits into
marcoroth:mainfrom
joelhawksley:1226
Open

Linter: Implement a11y-svg-has-accessible-text rule#1669
joelhawksley wants to merge 9 commits into
marcoroth:mainfrom
joelhawksley:1226

Conversation

@joelhawksley
Copy link
Copy Markdown
Contributor

Add a new linter rule that ensures <svg> elements have accessible text. The rule reports an offense when an <svg> is missing all of the following:

  • aria-label attribute
  • aria-labelledby attribute
  • A nested <title> child element

SVGs marked as decorative with aria-hidden="true" are exempt.

Based on the erblint-github GitHub::Accessibility::SvgHasAccessibleText rule.

Closes #1226

@joelhawksley joelhawksley marked this pull request as draft April 22, 2026 15:33
@joelhawksley joelhawksley marked this pull request as ready for review April 22, 2026 19:29
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 8, 2026
Add a new linter rule that ensures `<svg>` elements have accessible text.
The rule reports an offense when an `<svg>` is missing all of the following:

- `aria-label` attribute
- `aria-labelledby` attribute
- A nested `<title>` child element

SVGs marked as decorative with `aria-hidden="true"` are exempt.

Based on the erblint-github `GitHub::Accessibility::SvgHasAccessibleText` rule.

Closes marcoroth#1226
@marcoroth marcoroth changed the title Implement a11y-svg-has-accessible-text linter rule Linter: Implement a11y-svg-has-accessible-text rule May 22, 2026
Comment thread javascript/packages/linter/src/rules/a11y-svg-has-accessible-text.ts Outdated
Signed-off-by: Marco Roth <marco.roth@intergga.ch>
marcoroth added a commit that referenced this pull request Jun 6, 2026
This pull request updates the AST utils related to elements and
attributes in core to also account for the `HTMLConditionalOpenTagNode`
node type, so linter rules like #1669 can more easily build the logic
for the linter rules.
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-svg-has-accessible-text rule

2 participants