-
Notifications
You must be signed in to change notification settings - Fork 9
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 an eslint rule for checking interactivity of tooltip trigger #51
Conversation
🦋 Changeset detectedLatest commit: 33b5969 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So cool! 🥳 Loving this plugin. Left a couple of comments and questions, let me know what you think 👀
Co-authored-by: Josh Black <joshblack@github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So good! 🔥
@joshblack I realised that I forgot to add some Primer components 🙈 Like |
src/rules/__tests__/a11y-tooltip-non-interactive-trigger.test.js
Outdated
Show resolved
Hide resolved
@broccolinisoup Can you update the following files to include this new rule: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, @broccolinisoup! Just left one naming suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, @broccolinisoup! Just left one naming suggestion.
Adding an eslint rule to check if the
Tooltip
component includes an interactive trigger.Rule Details
This rule enforces to use interactive elements as tooltip triggers. Interactive elements can be Primer
Button
,IconButton
andLink
components or native elements likebutton
,a
with anhref
attribute,select
,textarea
,summary
andinput
(that is not ahidden
type).👎 Examples of incorrect code for this rule:
👍 Examples of correct code for this rule:
Options
skipImportCheck
(default:false
)By default, the
a11y-tooltip-non-interactive-trigger
rule will only check for interactive elements in components that are imported from@primer/react
. You can disable this behavior by settingskipImportCheck
totrue
. This is used for internal linting in the primer/react repository.