-
Notifications
You must be signed in to change notification settings - Fork 30
fix(components): Hide tooltips when out of view #2894
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
When a tooltip was scrolled out of view, it was still visible. This is now fixed using FloatingUI's `hide()` middleware to detect when it's out of view.
| style={floatingStyles.float} | ||
| ref={setTooltipRef} | ||
| role="tooltip" | ||
| hidden={isHidden} |
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.
Ensures it's hidden from screen readers
Deploying atlantis with
|
| Latest commit: |
24f89c0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ee485c58.atlantis.pages.dev |
| Branch Preview URL: | https://job-148568-hide-tooltips-whe.atlantis.pages.dev |
I can log a bug ticket for that. Indeed that sounds like it's outside the scope of this Tooltip issue. |
ZakaryH
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.
LGTM, the only thing I would ask for are some visual regression tests. still happy to approve without them though.
| @@ -1,88 +1,59 @@ | |||
| import { | |||
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.
@ZakaryH I updated the tooltip tests as discussed.
I broke it into 2 commits:
- with my fix disabled, so it's the before state: eb0c2ed
- with my fix enabled, and you can see the offscreen tooltip is no more! 24f89c0
Demo is here if you want to test while running the docs site: http://localhost:5173/visual-tests/tooltip
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.
ZakaryH
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.
still LGTM thanks for adding the tests!




Motivations
This PR fixes an issue where tooltips, when out of view, aren't technically hidden and can cause scrollbars unnecessarily.
Using the hide middleware from FloatingUI to handle this, as suggested by @ZakaryH.
Before
Tooltip remains visible when scrolled out of view, leading to the scrollable area increasing.
Screen.Recording.2026-01-30.at.2.58.54.PM.mov
After
Tooltip no longer is visible when out of view.
Screen.Recording.2026-01-30.at.2.59.10.PM.mov
Changes
Fixed
Testing
docs/components/Combobox/Web.stories.tsxisHidden: false, repeat the steps and you'll see the tooltip still visible as it's scrolled outside of the inner containerSnippet...