You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Tooltip] Stays visible when scrolling away #44548
Hover over one of the tooltips in the Last Name column
Scroll away (without moving the mouse)
You'll notice the tooltip stays open
Current behavior
The tooltip stays open on scroll .
Expected behavior
The tooltip should close when scrolled away from.
Context
We are using a tooltip inside of a data grid. When a user hovers the tooltip, we have an api call that happens to populate the it's contents. This call takes milliseconds to complete. When a user hovers the tooltip, and scrolls in the Datagrid, the tool tip stays open even though the user's cursor is no longer hovering the tooltip.
Order ID: 80452
Your environment
npx @mui/envinfo
Don't forget to mention which browser you used.
Output from `npx @mui/envinfo` goes here.
I'm able to reproduce the behavior you describe. Not sure if it can be considered a bug or not.
React Aria and Radix close the tooltip as soon as the cursor leaves the trigger, no matter if a scroll event or the user moving te cursor caused it. Ariakit has the same behavior as the one in Material UI: the tooltip is not closed when the cursor leaves the trigger because of the user scrolling; it's only closed after the user moves the cursor.
I've updated the stackblitz code to have a timeout to simulate an api call to set the text and opening the tool tip (This is what we're doing in our application). If you hover over one, and quickly move to a different one or scroll, you'll be able to tell when you even move the mouse, that the tooltip stays open.
Closing when the cursor leaves the trigger no matter the reason (scroll, actual cursor move) feels more correct to me. It would also be closer to how the behavior is described in:
@BTish I agree with @mj12albert. What you're trying to achieve is outside of a tooltip pattern.
Maybe a Popover is better suited for your use case. We had a recent issue where this was discussed, see #44554 (comment). Tooltips are meant to display secondary info (e.g. provide more context on a button that performs an action) while popovers are meant to display primary info and the sole purpose of the popover trigger is to open the trigger. Let me know if this helps.
In a future major version, once we adopt Base UI in Material UI's Popover, we'll have first-class support to open Popovers via hover.
@mj12albert I mixed a couple of issues in my previous response, sorry about that. I redacted my comment. I agree, closing the Tooltip when scrolling away seems a better default. Do you know how this will be handled in the Base UI rewrite? AFAIK the tooltip is closed when scrolling away but only after the user has stopped scrolling.
@BTish if the content you're displaying in the Tooltip is something that's vital for the UX and not something secondary, maybe Popover is a better fit for your use case.
@BTish if the content you're displaying in the Tooltip is something that's vital for the UX and not something secondary, maybe Popover is a better fit for your use case.
Sounds great. Thanks @aarongarciah. I've talked with our UI/UX and we're going to go with the Popover route.
changed the title [-][Tooltip] Tooltip stays on when scrolling in a DataGrid[/-][+][Tooltip] Tooltip stays visible when scrolling away[/+]on Nov 27, 2024
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@BTish Thanks again for creating this issue! If you have a moment, we would love to hear your thoughts on how we handled it with this short feedback form.
Activity
aarongarciah commentedon Nov 26, 2024
I'm able to reproduce the behavior you describe. Not sure if it can be considered a bug or not.
React Aria and Radix close the tooltip as soon as the cursor leaves the trigger, no matter if a scroll event or the user moving te cursor caused it. Ariakit has the same behavior as the one in Material UI: the tooltip is not closed when the cursor leaves the trigger because of the user scrolling; it's only closed after the user moves the cursor.
BTish commentedon Nov 26, 2024
@aarongarciah - Thanks for the quick reply.
I've updated the stackblitz code to have a timeout to simulate an api call to set the text and opening the tool tip (This is what we're doing in our application). If you hover over one, and quickly move to a different one or scroll, you'll be able to tell when you even move the mouse, that the tooltip stays open.
mj12albert commentedon Nov 27, 2024
Closing when the cursor leaves the trigger no matter the reason (scroll, actual cursor move) feels more correct to me. It would also be closer to how the behavior is described in:
The ARIA pattern (though a WIP):
Material Design 2:
aarongarciah commentedon Nov 27, 2024
@BTish I agree with @mj12albert.
What you're trying to achieve is outside of a tooltip pattern.Maybe a Popover is better suited for your use case. We had a recent issue where this was discussed, see #44554 (comment). Tooltips are meant to display secondary info (e.g. provide more context on a button that performs an action) while popovers are meant to display primary info and the sole purpose of the popover trigger is to open the trigger. Let me know if this helps.
In a future major version, once we adopt Base UI in Material UI's Popover, we'll have first-class support to open Popovers via hover.
mj12albert commentedon Nov 27, 2024
Wait, regardless of the use-case, we are all agreeing with OP's reported current and expected behavior right? (the Datagrid part isn't relevant)
I think this could be considered a bug 🤔
aarongarciah commentedon Nov 27, 2024
@mj12albert I mixed a couple of issues in my previous response, sorry about that. I redacted my comment. I agree, closing the Tooltip when scrolling away seems a better default. Do you know how this will be handled in the Base UI rewrite? AFAIK the tooltip is closed when scrolling away but only after the user has stopped scrolling.
@BTish if the content you're displaying in the Tooltip is something that's vital for the UX and not something secondary, maybe Popover is a better fit for your use case.
BTish commentedon Nov 27, 2024
Sounds great. Thanks @aarongarciah. I've talked with our UI/UX and we're going to go with the Popover route.
[-][Tooltip] Tooltip stays on when scrolling in a DataGrid[/-][+][Tooltip] Tooltip stays visible when scrolling away[/+][-][Tooltip] Tooltip stays visible when scrolling away[/-][+][Tooltip] Stays visible when scrolling away[/+]aarongarciah commentedon Nov 27, 2024
Nice @BTish. I'll keep this issue open so we tackle this in the future although this issue will probably be solved once we adopt Base UI.
ZeeshanTamboli commentedon Nov 27, 2026
Closing this. See #49815 (comment)
github-actions commentedon Nov 27, 2026
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@BTish Thanks again for creating this issue! If you have a moment, we would love to hear your thoughts on how we handled it with this short feedback form.