Repository navigation
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.
@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.
hellofanny
left a comment
There was a problem hiding this comment.
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.
| 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.
|
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 <[email protected]>
|
@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:placementis"top",dismissableisfalse, andmaxWidthis300.When
dismissableis enabled, the tooltip uses anIconButtonfor the dismiss action.How to test it?
Starters Deploy Preview
Preview
References
JIRA TASK: SFS-2070
Figma