Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create rule: no-visually-hidden-interactive-element #89

Merged
merged 5 commits into from
Jul 21, 2023

Conversation

kendallgassner
Copy link
Contributor

@kendallgassner kendallgassner commented Jul 21, 2023

What

This rule checks that interactive elements are not visually hidden.

Visually hiding content can be useful when you want to provide information specifically to screen reader users or other assistive technology users while keeping content hidden from sighted users.

How this differs from the eslint rule

  • does not take into account as prop since erb files do not have an as prop
  • does not allow for className to be configured. We only check for the sr-only class.

Copy link
Contributor

@lindseywild lindseywild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment about the examples, but this looks good otherwise!

Comment on lines 27 to 33
<h2 className="sr-only">Welcome to GitHub</h2>
```

👍 Examples of **correct** code for this rule:

```jsx
<h2 className="sr-only">Welcome to GitHub</h2>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the same example 🤔

@kendallgassner kendallgassner changed the title Add visually hidden interactive rule Create rule: no-visually-hidden-interactive-element Jul 21, 2023
@kendallgassner kendallgassner merged commit cb685d7 into main Jul 21, 2023
@kendallgassner kendallgassner deleted the add_visually_hidden_interactive_rule branch July 21, 2023 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants