modal adding unwanted padding-right on body
See original GitHub issueThanks for otherwise awesome work!
Current behavior
Modal is adding a padding-right: 15px
style on body
tag. I understand this is to compensate for possible scrollbars, but in our case it messes with our design. Our body elements are meant to stretch all the way to the right edge, and the body padding makes it look broken.
Happens here:
if (document.body.scrollHeight > window.innerHeight) {
// add padding so the content doesn't shift after removal of scrollbar
states.previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'));
document.body.style.paddingRight = states.previousBodyPadding + measureScrollbar() + 'px';
}
Expected behavior
Don’t change padding of html body.
(Alternatively, allow me to turn this feature off through config)
Demo
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Bootstrap Modals keep adding padding-right to body after ...
The problem is caused by a function in the bootstrap jQuery that adds a bit of padding-right when a modal window opens if...
Read more >Unnecessary padding-right added to modal · Issue #17622
Hello, When a modal is open, a padding-right is added even when it's not needed (Bootstrap 3.3.5 in latest firefox and latest chrome)....
Read more >Remove the padding right modal on navigation
Hello, today I install the modal button in my navigation. When I click on the icon I see a style who appared on...
Read more >Modal – Carbon Design System
If the modal is smaller than 36% then it has a fixed margin-right: 16px/1rem . Body copy, including titles, in a modal always...
Read more >padding - CSS: Cascading Style Sheets - MDN Web Docs
An element's padding area is the space between its content and its border. Note: Padding creates extra space within an element. In contrast, ......
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 Free
Top 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
@limonte @tomholub sounds good to me. I’ll start implementing it…
Noted, will do!