Skip to content
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

Tooltip: Do not wrap the tooltip and the trigger in a div #4056

Merged
merged 3 commits into from
Dec 18, 2023

Conversation

broccolinisoup
Copy link
Member

@broccolinisoup broccolinisoup commented Dec 13, 2023

Changelog

New

Changed

Removed the div wrapper because it was causing styling issues on the icon buttons (WIP PR) and added mouse enter and leave events to the tooltip to make sure it stays open when it is hovered. I don't think we need it but let me know if I am missing anything.

-<div> 👈 wrapper 
  <button>tooltip trigger</button>
  <div>tooltip itself</div>
-</div>

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

Copy link

changeset-bot bot commented Dec 13, 2023

🦋 Changeset detected

Latest commit: 2e500db

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

This PR includes changesets to release 1 package
Name Type
@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

Copy link
Contributor

github-actions bot commented Dec 13, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 105.56 KB (+0.02% 🔺)
dist/browser.umd.js 106.14 KB (+0.02% 🔺)

@broccolinisoup broccolinisoup changed the title Do not wrap the tooltip and the trigger in a div Tooltip: Do not wrap the tooltip and the trigger in a div Dec 13, 2023
@@ -34,6 +34,7 @@ const InactiveIndicator: React.FC<{
padding: 0,
font: 'inherit',
cursor: 'pointer',
display: 'flex',
Copy link
Member Author

Choose a reason for hiding this comment

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

Due to removing the wrapper in the tooltip, I needed to add this to align the inactive visual in center. Let me know if you prefer a different way to do it @mperrotti

@broccolinisoup broccolinisoup marked this pull request as ready for review December 13, 2023 06:18
Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

Definitely makes sense to avoid an extra wrapper!

Am I right in assuming that because tooltip is now in top layer, removing this wrapper makes no difference to positioning?

@broccolinisoup
Copy link
Member Author

broccolinisoup commented Dec 14, 2023

Am I right in assuming that because tooltip is now in top layer, removing this wrapper makes no difference to positioning?

Yes! Because we use popover, tooltip is always on the top layer. Also because we use anchor positioning to set top and left for the tooltip div, it makes no difference how it is placed in the dom. The tests and stories are looking too ✨ @siddharthkp

@broccolinisoup broccolinisoup added this pull request to the merge queue Dec 18, 2023
Merged via the queue into main with commit 752bea4 Dec 18, 2023
33 checks passed
@broccolinisoup broccolinisoup deleted the bs/tooltip-no-wrap branch December 18, 2023 01:07
This was referenced Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants