Skip to content

feat: add tooltip component - #2644

Merged
hellofanny merged 12 commits into
mainfrom
feat/add-tooltip-component
Feb 18, 2025
Merged

hellofanny merged 12 commits into
mainfrom
feat/add-tooltip-component

Conversation

@artursantiago

@artursantiago artursantiago commented Jan 28, 2025 •

Copy link
Copy Markdown
Contributor

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 is false, and maxWidth is 300.

When dismissable is enabled, the tooltip uses an IconButton for the dismiss action.

How to test it?

Starters Deploy Preview

Preview

References

JIRA TASK: SFS-2070

Figma

image

@artursantiago artursantiago added the enhancement New feature or request label Jan 28, 2025
@artursantiago artursantiago self-assigned this Jan 28, 2025
@vercel

vercel Bot commented Jan 28, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
faststore-site ✅ Ready (Inspect) Visit Preview Jan 28, 2025 5:45pm

@codesandbox-ci

codesandbox-ci Bot commented Jan 28, 2025 •

Copy link
Copy Markdown

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.

@artursantiago
artursantiago marked this pull request as ready for review January 30, 2025 17:43
@artursantiago
artursantiago requested a review from a team as a code owner January 30, 2025 17:43
@artursantiago
artursantiago requested review from eduardoformiga and lucasfp13 and removed request for a team January 30, 2025 17:43
@artursantiago
artursantiago force-pushed the feat/add-tooltip-component branch from d454cc5 to 1269495 Compare February 4, 2025 18:36
/**
* If the tooltip can be closed by a button.
*/
dismissible?: boolean

Copy link
Copy Markdown
Contributor

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.

@hellofanny hellofanny left a comment

Copy link
Copy Markdown
Contributor

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!

@artursantiago
artursantiago force-pushed the feat/add-tooltip-component branch from 3dc1acf to 22635fd Compare February 17, 2025 20:13

return (
<div
data-fs-tooltip-wrapper

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done ✅

@hellofanny

Copy link
Copy Markdown
Contributor

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!

image

@hellofanny
hellofanny self-requested a review February 18, 2025 14:00

@hellofanny hellofanny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

well done!! 🚀

@hellofanny
hellofanny merged commit ed1826d into main Feb 18, 2025
@hellofanny
hellofanny deleted the feat/add-tooltip-component branch February 18, 2025 14:08
@hellofanny

Copy link
Copy Markdown
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants