Skip to content

Fix for nonInteractiveLink rule #73

New issue

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

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

Already on GitHub? # to your account

Merged
merged 4 commits into from
Jul 28, 2023

Conversation

TylerJDev
Copy link
Member

@TylerJDev TylerJDev commented Jul 28, 2023

Summary

a11y-tooltip-interactive-trigger may throw an error on <Tooltip> usages that use values other than a string for the href attribute:

a11y-tooltip-interactive-trigger throws an error (nonInteractiveLink) for the following:

  <Tooltip aria-label={avatar.avatarName} direction="e">
    <Link href={avatar.avatarLink} underline={true}>
      User avatar
    </Link>
  </Tooltip>

This is because a value is being passed to the href through JSX, (i.e. avatar.avatarLink). This PR aims to pass possible nonInteractiveLink errors if they have an href with a JSX-like value.

In addition, this PR adds optional chaining to getJSXOpeningElementAttribute to avoid an error being thrown when no name is present.

@changeset-bot
Copy link

changeset-bot bot commented Jul 28, 2023

🦋 Changeset detected

Latest commit: 9e1bd45

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-primer-react Patch

Not sure what this means? Click here to learn what changesets are.

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

@TylerJDev TylerJDev merged commit 2f8f9c4 into main Jul 28, 2023
@primer-css primer-css mentioned this pull request Jul 28, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants