Skip to content

Implement a11y-avoid-generic-link-text linter rule#1673

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

Implement a11y-avoid-generic-link-text linter rule#1673
joelhawksley wants to merge 1 commit intomarcoroth:mainfrom
joelhawksley:1218

Conversation

@joelhawksley
Copy link
Copy Markdown
Contributor

Implements the a11y-avoid-generic-link-text rule from erblint-github's AvoidGenericLinkText.

This rule flags <a> elements with generic link text such as "Read more", "Learn more", "Click here", "More", "Link", or "Here" which do not make sense when read out of context. Screen reader users often navigate by links, so descriptive link text is important for accessibility.

Links with aria-label or aria-labelledby attributes are not flagged, as those provide an accessible name. Links with dynamic ERB content are also skipped since the text cannot be statically analyzed.

The rule is disabled by default with a severity of warning.

Closes #1218

Implements the `a11y-avoid-generic-link-text` rule from erblint-github's `AvoidGenericLinkText`.

This rule flags `<a>` elements with generic link text such as "Read more", "Learn more", "Click here", "More", "Link", or "Here" which do not make sense when read out of context. Screen reader users often navigate by links, so descriptive link text is important for accessibility.

Links with `aria-label` or `aria-labelledby` attributes are not flagged, as those provide an accessible name. Links with dynamic ERB content are also skipped since the text cannot be statically analyzed.

The rule is disabled by default with a severity of `warning`.

Closes marcoroth#1218
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-avoid-generic-link-text rule

1 participant