Skip to content
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

Cannot use Select inside Tooltip that has ClickAwayListener #39095

Closed
2 tasks done
nishikantparmariam opened this issue Sep 21, 2023 · 2 comments
Closed
2 tasks done

Cannot use Select inside Tooltip that has ClickAwayListener #39095

nishikantparmariam opened this issue Sep 21, 2023 · 2 comments
Assignees
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

Comments

@nishikantparmariam
Copy link

nishikantparmariam commented Sep 21, 2023

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example: https://codesandbox.io/s/quizzical-allen-vsg344?file=/Demo.js

Steps:

  1. Click on Click
  2. Select a value from Select component
  3. Notice that the Select options come behind the Tooltip

Current behavior 😯

mui-tooltip-select-issue

(Similar issue reported in #36278 (comment) with Popper) An attempt to increase zIndex of MenuProps (uncomment line 26 in above code), closes the Tooltip abnormally:

mui-tooltip-select-issue-2

An attempt to pass MenuProps={{disablePortal: true}} in Select (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 with disablePortal: 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 pass disablePortal:true, certain CSS, and determine position yourselves if you want to make Select work inside Tooltip. Is there a better way?

mui-tooltip-3

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 in title 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)

@nishikantparmariam nishikantparmariam added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 21, 2023
@zannager zannager added 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! component: ClickAwayListener The React component labels Sep 21, 2023
@samuelsycamore
Copy link
Contributor

I would argue that this is an inappropriate use of a tooltip. According to Nielsen Norman Group's Tooltip Guidelines, a tooltip should only be used to display brief messages that are not vital to the user's completion of a task. As such, I can't think of a valid use case for placing a Select inside of one. It looks like you'd be better off using a Menu instead.

@samuelsycamore samuelsycamore closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2023
@samuelsycamore samuelsycamore added status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 10, 2023
@nishikantparmariam
Copy link
Author

I agree that one should not use Select inside Tooltip but these issues exist in Popper also - #36278 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

4 participants