Cannot use Select inside Tooltip that has ClickAwayListener #39095
Labels
component: ClickAwayListener
The React component
component: select
This is the name of the generic UI component, not the React module!
component: tooltip
This is the name of the generic UI component, not the React module!
status: expected behavior
Does not imply the behavior is intended. Just that we know about it and can't work around it
Duplicates
Latest version
Steps to reproduce 🕹
Link to live example: https://codesandbox.io/s/quizzical-allen-vsg344?file=/Demo.js
Steps:
Click
Current behavior 😯
(Similar issue reported in #36278 (comment) with Popper) An attempt to increase
zIndex
ofMenuProps
(uncomment line 26 in above code), closes the Tooltip abnormally:An attempt to pass
MenuProps={{disablePortal: true}}
inSelect
(as suggested in https://stackoverflow.com/a/61544521/22132048) works but it makes the position and CSS of Select options very odd, is there a way to make it as it is withdisablePortal: false
? Also, I would expose this as a library and we allow users to render their custom component inside Tooltip, the problem is we would have to tell users/document that passdisablePortal:true
, certain CSS, and determine position yourselves if you want to make Select work inside Tooltip. Is there a better way?Expected behavior 🤔
Select options should work properly on top of Tooltip/Popper.
Context 🔦
My use-case is to open a Tooltip / Popper upon an icon click, I also want that Tooltip should hide if user clicks away so I've used
ClickAwayListener
. Inside the Tooltip, I want to render a custom component intitle
that has Selects, Buttons, TextInputs etc. I found this behavior specially with Select component.Please suggest solutions/workarounds. Thanks!
Your environment 🌎
Browser: Chrome Version 116.0.5845.188
MUI Version: Reproducible in Latest (See sandbox example)
The text was updated successfully, but these errors were encountered: