Implement a11y-no-visually-hidden-interactive-elements linter rule#1671
Open
joelhawksley wants to merge 2 commits intomarcoroth:mainfrom
Open
Implement a11y-no-visually-hidden-interactive-elements linter rule#1671joelhawksley wants to merge 2 commits intomarcoroth:mainfrom
a11y-no-visually-hidden-interactive-elements linter rule#1671joelhawksley wants to merge 2 commits intomarcoroth:mainfrom
Conversation
Implements the `a11y-no-visually-hidden-interactive-elements` rule from erblint-github's `NoVisuallyHiddenInteractiveElements`. This rule flags interactive elements (a, button, summary, select, option, textarea) that have the `sr-only` CSS class, which visually hides them. Sighted keyboard users navigating to a visually hidden interactive element may become confused, thinking keyboard focus has been lost. Note: `input` elements are intentionally not flagged to avoid false positives (e.g. file inputs). Closes marcoroth#1225
|
Wouldn't this rule incorrectly flag things like |
Avoid flagging interactive elements that use sr-only alongside focus:not-sr-only or focus-within:not-sr-only, since these elements become visible on focus (e.g. skip-to-content links). Co-authored-by: Bruno Prieto <brunoprietog@users.noreply.github.com>
Contributor
Author
|
@brunoprietog that's a good point! The original rule from rubocop-github did not account for those patterns. I went ahead and added tests and a fix and put your name on the commit ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the
a11y-no-visually-hidden-interactive-elementsrule from erblint-github'sNoVisuallyHiddenInteractiveElements.This rule flags interactive elements (
a,button,summary,select,option,textarea) that have thesr-onlyCSS class, which visually hides them. Sighted keyboard users navigating to a visually hidden interactive element may become confused, thinking keyboard focus has been lost.Note:
inputelements are intentionally not flagged to avoid false positives (e.g. file inputs).Closes #1225