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

Add mapping of "Box" to "div" #176

Merged
merged 4 commits into from
May 15, 2024

Conversation

khiga8
Copy link
Contributor

@khiga8 khiga8 commented May 14, 2024

Fixes: #170

This PR adds a mapping of Box to div to expand a11y linting coverage.

eslint-plugin-github has an a11y rule, a11y-role-supports-aria-props, which will flag invalid ARIA usage such as:

<Box as="div" aria-label="Something">

The plugin can lint the above markup by reading the value of the as prop, and interpreting it as a div.

However, because we don't have a mapping defined for Box for when as isn't set, the following isn't currently flagged even though it should be flagged as invalid:

<Box aria-label="Something">

This PR should will address this issue. I've tested this in dotcom.

I opted to only add the mapping for eslint-plugin-github because we have not enabled polymorphic linting for jsx-a11y rules yet, and if we define the mapping for jsx-a11y, it may raise false positives by always treating Box as a div.

Copy link

changeset-bot bot commented May 14, 2024

⚠️ No Changeset found

Latest commit: 6824024

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@khiga8 khiga8 requested a review from TylerJDev May 15, 2024 13:22
@khiga8 khiga8 marked this pull request as ready for review May 15, 2024 13:22
@khiga8 khiga8 requested a review from a team as a code owner May 15, 2024 13:22
Copy link
Contributor

@TylerJDev TylerJDev left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for adding this ✨

@khiga8 khiga8 merged commit 4302562 into main May 15, 2024
7 checks passed
@khiga8 khiga8 deleted the kh-extend-mapping-to-expand-linting-support branch May 15, 2024 15:02
@khiga8
Copy link
Contributor Author

khiga8 commented May 15, 2024

Oh crap! I need to add a changeset 🤦‍♀️

khiga8 added a commit that referenced this pull request May 15, 2024
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.

[Story] Ensure the <Box aria-label> is flagged as inaccessible markup
2 participants