-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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 stays displayed on top of MenuItem components of a Select component #11186
Comments
@oliviertassinari I would like to know if this actually an issue or not, if possible! I know that a Button with a Menu/MenuItems has the behavior that I want but I am limited to the use of Select in my case. |
I'm experiencing the same issue. I have a tooltip on an icon button that opens a dialog. After the dialog is dismissed, the tooltip appears and will remain active until the button is activated with a mouseover event. |
I found a fix for my issue. See here. |
I think there are two separate issues here. The first issue (@Tuaniwan's example) occurs when using a There is an open issue about this on the React repo facebook/react#11387. |
I got my asnwer here. |
The controlled answer looks good to me: https://codesandbox.io/s/oxlmqo4m9z. |
I am still experiencing this issue. Currently using a TextField component with the type "select" (the Select component's label is buggy when it shrinks to the top that's why i need it like this) and with the controlled Tooltip open/!open state with the events onMouseEnter, onMouseLeave works just fine but the onClick not. CodeSandbox: https://codesandbox.io/s/sharp-rain-7y0be?file=/src/App.tsx |
I also faced same issues while using With controlled tooltip, Instead, using const renderValueWrappedByTooltip = (value: any) => {
return (
<Tooltip title={title} placement='top'>
<div className={classes.selectValue}>{value}</div>
</Tooltip>
);
};
return (
<Select
...
renderValue={renderValueWrappedByTooltip}
>
...
</Select>
); |
try this simple solution with z-index. we have control without making state also |
When using a Tooltip component around a Select component containing MenuItems, when you click the Select (not only Tooltip stays displayed but it also sticks above the MenuItems) and click a MenuItem, the Tooltip stays displayed as if we were still hovering the Select component. Now to make it disappear you can re-hover the Select, or click anywhere else in the DOM.
I feel like these are two separate issues.
The Tooltip having a z-Index above the one of the MenuItem (although this may be specific to my very own use case only)
The other one would be that the tooltip stays displayed after clicking a MenuItem to change the Select's value, when it is not even being hovered anymore.
Expected Behavior
When clicking the Select component, the tooltip should disappear. Therefore, when the MenuItems appear, they won't have the tooltip on top of them, and if your MenuItems have a tooltip, it will still be displayed above the other MenuItems as you would expect it and the tooltip would still be invisible after selecting an item in the Select component.
Current Behavior
The tooltip stays displayed on top of everything until the Select component is hovered, or the user clicks anywhere other than the Select component.
Steps to Reproduce (for bugs)
Here is the live example on codesandbox.io.
Context
Your Environment
The text was updated successfully, but these errors were encountered: