-
-
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
[Select][material-ui] Don't lock the body scroll and make it non-modal select #17353
Comments
Any update on this issue? I have a select element inside a hero/landing page. When the select menu opens, scroll gets locked. And that causes |
This comment was marked as resolved.
This comment was marked as resolved.
Quote from eplumecocq for a Select fix
Which means that if you have this problem for a menu, just add |
@jeronimomora Unfortunately, this isn't enough to solve the problem, the position won't be correct. I would also expect the backdrop to be removed, and the aria inert not to be applied. |
Following, also experiencing this with Select component. | Material-UI | v3.9.2 | |
While this seems to works for the Select component, React throws the following warning. I suspect this is because there is no child Menu compnent under Select. Select only has the Menuiitem components as children.
|
Any updates ? I also have the problem with version 4.8.2 when displaying drawers, menus. The disableScrollLock works for me on the Menus but this is not a satisfying solution IMO. |
I'm having a scroll bar issue with the Select component as well - the scroll bar appears when hovering over it and disappears on mouse leave. It causes a janky visual effect. Setting overflow-y to hidden on all sorts of elements doesn't fix it. Anyone else run into this and solve it? |
Personnaly i've locked the version on 4.6.x, you can try the disableScrollLock prop trick else |
In my case this problem is caused by Tooltip component. It is a bit strange issue. if I use it like this: it adds padding-right to the body (17px), but if I remove Tooltip from inside the ActionButton component and wrap it from outside like this: |
Seeing the same behavior as @Dito-Orkodashvili with a If the box model is close to showing the vertical scrollbar, opening the menu will add the As a workaround set the tooltip's title to nothing when the
@material-ui/core 4.9.5 |
I've spent 4 hours on this weird behaviour. @sedatbasar 's solution works fine, though. Don't know if there is any major implications out of it. |
If you want the |
Hi everyone! Thanks for your patience. We've added a workaround for this use case in #37773, released in version <Select
MenuProps={{
// disable scroll lock
disableScrollLock: true,
// allow the menu to go outside the window
marginThreshold: null
}}
/> Here's a CodeSandbox example of this. Doing so on a I'll close this issue as this workaround enables the scroll behavior when the select is open. If you have any questions, don't hesitate to leave a comment. Feel free to open a new issue if you encounter any problems with the workaround. |
@DiegoAndai your demo looks great, but I think this issue is about having a non-modal select, per #17353 (comment). In https://codesandbox.io/s/issue-17353-scrollable-text-field-select-forked-8hq5xr, there is still aria-hidden=true on all the elements of the page, and most importantly, can't focus on the input in one click it takes two. |
@oliviertassinari The original intent of this issue is that when Select opens, it shouldn't lock the page's scroll. We won't make that change in v5 as it's a breaking change, so adding a workaround to achieve it is the next best thing we can do. Keeping this issue open is not useful IMO. It has a lot of comments and opinions, so it's hard to read and understand the scope. I propose closing it. I agree that there is value in this issue's comments, like #17353 (comment). The Select component is next in line to be migrated to use Base UI for v6. For that work we should keep these in mind cc: @mj12albert |
Let's create a new issue about this, seems like it is a bit different than the original issue. @DiegoAndai please include the original comment too. We can generalize the issue to all components that use modals, to allow a modal and non-modal options. I have partially covered this in #38630 |
I created a new issue to track the non-modal select option for v6: #38756. Do you think we can close this one now, @oliviertassinari? |
I think that this issue is a subset of #38756 (cover more components). I mean, I fail to understand why people would land here to only ask to allow the scrollbar and not to allow focus on the page too, or keeping any modal behavior. If we close this one, we would lose the 👍, I think it's better open for visibility. |
added this
To overcome any CSS or JavaScript preventing the body from scrolling or locking the scroll bar. But I ended up with the MUI offset of the right margin of the screen, like it fluctuates to the opposite. I made that to stop the fluctuation from the scrollbar hiding, but MUI still got another offset. |
Current Behavior 😯
When I open a Select component vertical scroll bar of the page disappears.
See here
I don't have a demo to reproduce sorry, but I suppose this is a known issue: #8710, #7239, so maybe someone can help.
The select component is located on an app bar on the screenshot.
I tried setting box-sizing: border-box on App bar, no help.
Expected Behavior 🤔
The scrollbar should not disappear.
Your Environment 🌎
The text was updated successfully, but these errors were encountered: