-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Select] Menu opens above input with lots of options in v5 without a maxHeight #36776
Comments
hi i would like to pick these issue |
is there any update to this? I really needed this and unfortunately I don't have enough knowledge to understand the MUI library and fix it. |
@raccmonteiro just wating for someone to respond. So can I start working on this problem? |
@michaldudak are you working on this issue? |
The position of the Popover under the Select is dynamically calculated based on the anchorEl. When you resize the window the window's Maybe I am missing something here. cc @michaldudak |
@ZeeshanTamboli I updated the description: "This popover over the input also happens when we have a lot of options that does not fit into screen, it's not just with resizing. I can live without the resizing part, but when I click on the input to open the menu, the popover should open always below the input." |
@raccmonteiro If that's the case, it is similar to #34338. The solution is provided in #34338 (comment) to add maxHeight to the Menu. See https://codesandbox.io/s/gracious-james-7xbujq?file=/demo.js. I hope it helps. If resizing is not your concern we can close this issue. |
but in that case I need to calculate the screen size and find out the maxHeight for every Select I have, that's not a solution for me. I can use it temporarily but I would like to have a correct solution |
The maxHeight is a percent value so I think it should work on different sizes. Also, how would we know the amount of options you could have? How do you think we can handle that on our side? |
I am not sure. Since it was working well on v4, I thought this would be a simple fix |
I have the same scenario on my side, and set maxHeight is not a solution.... |
Alright, I am re-opening this issue. It works in Material UI v4 with lots of menu items without providing a maximum height to the Menu. Setting an inbuilt max-height on the Menu could be the solution. This is also vaguely similar to #21561. I am uncertain, but replacing the positioning logic of the Popover component with the Popper one could fix the issue. |
We've recently merged in #37773, which could help to solve this issue. Add Does this help? |
@michaldudak Hi, I'm picking up where @raccmonteiro left. I've reproduced an issue that arises if you add The Popover's height is fixed at Edit: on the second thought, it might not be the Popover, but MenuPaper, so I've updated my sandbox with a solution that overrides maxHeight on MenuPaper. I haven't found a generic enough solution for that yet, but maybe you could suggest something? Edit 2: I've introduced a stupid-enough-but-kinda-works solution to the sandbox, it requires calling getBoundingClientRect on Select's element and getting its offset to use in MenuPaper's maxHeight calculation. |
This worked for me. It would be great if we could "auto" position popover depending on media/window size. |
There actually are many cases in which we want to position automatically a popin around your text fields (/ and/or resize it automatically) depending on how much you are scrolled on the page or the window size. I'm not sure why Popover has not an option to auto position / auto placement the popover where there is enough space on the screen around the anchor, it looks very obvious in many libs but there maybe a specific reason ? (this is an example vue lib but there are dozens of them: https://bootstrap-vue.org/docs/components/popover with placement: auto) |
Are we planning to fix this issue anytime soon? Is there a workaround for this? |
Duplicates
Latest version
Steps to reproduce 🕹
No response
Current behavior 😯
See expected behavior first.
in v5 this does not work, and I tried a lot of different props and it does not work. Behavior in v5:
This popover over the input also happens when we have a lot of options that does not fit into screen, it's not just with resizing. I can live without the resizing part, but when I click on the input to open the menu, the popover should open always below the input.
Expected behavior 🤔
In v4 we could use this props in
Select
to have the menu always below the input:Context 🔦
I want the same behavior as in v4
Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: