Modal with a single child has padding that causes scrolling issue
See original GitHub issueSandbox here: https://codesandbox.io/s/webpack-starter-c9g77
I have a modal with a single span element inside. For some reason, I’m able to scroll down to the point where the element disappears if there is only one line of text.
Start:
After scrolling:
I believe it’s because of this styling:
.bx--modal-content>*:last-child {
padding-bottom: 2rem;
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Bootstrap Modal Issue - Scrolling Gets Disabled - Stack Overflow
One way to make it work, is to use the hidden.bs.modal event triggered by BS when closing a modal, then check if there...
Read more >[Modal] Scrollbar and padding issue #10000 - mui/material-ui
The downside is that when the scrollbar is present, centered children are now 10 pixels to the right of center, and I have...
Read more >overscroll-behavior - CSS: Cascading Style Sheets | MDN
The overscroll-behavior CSS property sets what a browser does when reaching the boundary of a scrolling area.
Read more >Modal - Bootstrap
Modals are built with HTML, CSS, and JavaScript. They're positioned over everything else in the document and remove scroll from the <body> so...
Read more >Prototype scrolling with overflow behavior - Figma Help Center
To apply overflow behavior, the frame must have content that extends beyond its bounds. If you change the bounds of the frame so...
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 padding-bottom from the last-of-child is separate from what’s keeping the content far enough from the buttons. I added the padding to the last child so that the overflow-indicator doesn’t overlap the text at the end of the scrolling content when
hasScrollingContent
is set to true. Since it’s causing problems when the overflow indicator isn’t there, I believe I can just change it to not show up if hasScrollingContent is false.The padding-bottom is causing the text to overflow, then causing the scrollbar to appear.