-
Notifications
You must be signed in to change notification settings - Fork 64
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
feat: add tooltip component #2644
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
d454cc5
to
1269495
Compare
e64bc11
to
a8e2f93
Compare
a8e2f93
to
d19ab92
Compare
/** | ||
* If the tooltip can be closed by a button. | ||
*/ | ||
dismissible?: boolean |
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.
@renatamottam do we really need to have this dismissible
prop?
The tooltip is expected to disappear when the focus is lost or on mouse out.
And according to this accessibility doc, it shouldn't contain interactive elements 🤔 So adding a button would be a problem (will add focus to the button). WDYT?
Ps: Add a big notice to the doc: this component should only be used for additional information and not for crucial content, as tooltip content may not be accessible to screen readers and could go unnoticed.
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.
I'm suggesting some a11y updates. It might be best to apply all the changes at once, test them locally, and then make any necessary adjustments ⭐ Thank you!
3dc1acf
to
22635fd
Compare
|
||
return ( | ||
<div | ||
data-fs-tooltip-wrapper |
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.
data-fs-tooltip-wrapper | |
data-fs-tooltip |
I know this might be a bit confusing, but I think it's best to maintain the existing pattern. The outer element should be named data-fs-component-name. Can you please, rename this element to data-fs-tooltip
, and rename the current data-fs-tooltip
to data-fs-tooltip-wrapper
? Also update in the stylesheet.
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.
Done ✅
I've tested the focus and Escape key functionality, and they are working as expected. I didn't test all placement variants, but I tried a few, and they worked fine. I'll just wait for this update before approving this PR! ![]() |
Co-authored-by: Fanny Chien <fanny.chien@vtex.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.
well done!! 🚀
@mariana-caetano JLYK I've created a doc request for this component. It would be better to double check this component in the main when creating the doc. |
What's the purpose of this pull request?
This pull request adds the Tooltip atom component. This component will be used in the ReviewCard for displaying reviews of a product in the new Reviews and Ratings section.
How does it work?
This PR introduces a new molecule component,
Tooltip
, which allows customization of its behavior and appearance. The component includes default values for some of its props:placement
is"top"
,dismissable
isfalse
, andmaxWidth
is300
.When
dismissable
is enabled, the tooltip uses anIconButton
for the dismiss action.How to test it?
Starters Deploy Preview
Preview
References
JIRA TASK: SFS-2070
Figma