[Modal] Scrollbar and padding issue
See original GitHub issueWhen a Menu
opens, the page’s scrollbar disappears. This may affect page layout. In my case, it jumps everything over to the right, which is a visual bug.
Solution
Either A) fix this in the library, or B) Note this behavior in the docs, and provide ways of solving it:
https://material-ui-next.com/demos/menus/
The container for the things jumping is absolute, left: 0, right: 0
, with sections that are either text-align: center
or display: flex; flex-direction: column; align-items: center;
Your Environment
Tech | Version |
---|---|
Material-UI | 1.0.0-beta.29 |
Related issues
These are all closed, and I didn’t find the solution in them:
Issue Analytics
- State:
- Created 6 years ago
- Reactions:35
- Comments:53 (19 by maintainers)
Top Results From Across the Web
Scrollbar and padding issue #23489 - [Modal] RTL - GitHub
The issue is about padding being added to the right side of the body instead left side for RTL. The issue is present...
Read more >Stop Modal from shifting with scrollbar using Material-UI's "mui ...
I can fix this with the "mui-fixed" class, but it adds extra padding on the right side of the modal that looks bad....
Read more >Modal - Bootstrap
Below is a static modal example (meaning its position and display have been overridden). Included are the modal header, modal body (required for...
Read more >Prevent Page Scrolling When a Modal is Open | CSS-Tricks
If we know the top of the scroll location and add it to our CSS, then the body will not scroll back to...
Read more >Modal Window pushes the sites content (Example) - Treehouse
Cause: Bootstrap applies a right padding of 29px every time modal is displayed in order to compensate for the browser's vertical scrollbar width ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The way I fixed it was just add
disableScrollLock={ true }
in my component 😃The solution re-iterated by @Toshiuk is to simply add the following:
Menu, StyledMenu:
disableScrollLock={ true }
Select:
MenuProps={{ disableScrollLock: true }}
We really need to make solutions more easily findable! 😃