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

fix: eslint warning "anchor-is-valid" #4181

Merged

Conversation

CorinaMurg
Copy link
Contributor

@CorinaMurg CorinaMurg commented Oct 25, 2024

Description

This PR fixes the eslint-jsx-a11y warning "anchor-is-invalid" present in components/atoms/ToggleGroup/toggle-group.stories.tsx. The "anchor-is-invalid" rule checks that all anchors are navigable elements.

The purpose of the CustomItems story in ToggleGroup is to demonstrate how to use HTML elements or nested elements as children of ToggleGroup. The first child was initially an <a> element nested inside a div, and the accessibility linter was complaining that the href value of # was invalid. Adding a valid href value would have taken care of the warning, however we would still be left with a serious accessibility issue not covered by the linter.

The children of the ToggleGroup are tabs, so basically buttons. Having a link nested inside a button creates accessibility issues for screen reader users, as well low-vision users and those relying on voice control. This PR replaces the <a> element with a <span>. Ideally, a future PR will look into restricting the children of ToggleGroup to only non-interactive elements.

Related Tickets & Documents

Fixes #4136

Mobile & Desktop Screenshots/Recordings

N/A

Steps to QA

N/A

Tier (staff will fill in)

  • Tier 1
  • Tier 2
  • Tier 3
  • Tier 4

[optional] What gif best describes this PR or how it makes you feel?

(Sorry, just flew in from the 20th century. What is a good resource for gifs?)

Copy link

netlify bot commented Oct 25, 2024

👷 Deploy request for oss-insights pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 7aa5bba

Copy link

netlify bot commented Oct 25, 2024

Deploy Preview for design-insights ready!

Name Link
🔨 Latest commit 7aa5bba
🔍 Latest deploy log https://app.netlify.com/sites/design-insights/deploys/671b05d5d9a0be00081d2b92
😎 Deploy Preview https://deploy-preview-4181--design-insights.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

PR Compliance Checks Passed!

Copy link
Member

@nickytonline nickytonline left a comment

Choose a reason for hiding this comment

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

Thanks @CorinaMurg! 🚢

@nickytonline nickytonline added this pull request to the merge queue Oct 25, 2024
Merged via the queue into open-sauced:beta with commit 5b67103 Oct 25, 2024
17 checks passed
open-sauced bot pushed a commit that referenced this pull request Oct 25, 2024
## [2.64.1-beta.1](v2.64.0...v2.64.1-beta.1) (2024-10-25)

### 🐛 Bug Fixes

* eslint warning "anchor-is-valid" ([#4181](#4181)) ([5b67103](5b67103))
@CorinaMurg CorinaMurg deleted the fix/eslint-warning-anchor-is-valid branch October 25, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enhancement: a11y rule "anchor-is-valid" fails with a warning.
3 participants