-
Notifications
You must be signed in to change notification settings - Fork 21
Refactor tooltip component to use floating-ui #1288
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Yeah @david-crespo this is something I think I need to follow up on upstream. So it seems it's only picking between the four primary sides (top, left, bottom, right) instead of doing what would be right in this situation by selecting |
|
So, yeah. Placements for the autoplacement middleware are ultimately chosen by this I'll work to put together a minimal reproduction and open up an issue upstream. |
david-crespo
left a comment
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.
Very clean. floating-ui looks great.
|
I do have one use case that's not the FieldLabel and not a button: #641 Something to follow up on is adding a short delay (maybe default on but configurable): https://floating-ui.com/docs/FloatingDelayGroup |
|
I'm going to go ahead and merge this. I'll work to have an upstream issue w/ a small replication of the rendering out of bounds issue we saw. Will follow up with breaking it down to be able to attach tooltips to other items too. |

Closes #854
This PR updates our tooltip implementation to use floating-ui. Previously we were using react-popper which is now in maintenance mode in favor of floating UI. Overall floating UI provides a more robust, composable API that's generic enough to be applied to any floating UI situation like tooltips, dropdown menus, etc.
I've also integrated the
elevationtokens which were added in #1284.I've tried to keep the baseline implementation as close to the original as possible to minimize changes. Eventually I'd like to be able to generically attach a tooltip to any element (and not have it tied to the underlying button like we have here), but that can wait until there's a specific usecase.