Clicking outside vertically centered Modal with static backdrop results in unwanted vertical scrollbar glitch
See original GitHub issueSteps to reproduce:
- Navigate to https://getbootstrap.com/docs/4.5/components/modal/#static-backdrop.
- Click ‘Launch static backdrop modal’ button.
- Open dev tools and inspect displayed modal div with
modal-dialog
class. - Add
modal-dialog-centered
class to this div (the documented way to create a vertically centered modal). - Exercise the static backdrop feature by clicking outside the modal.
- Note that the modal’s scale animation causes a vertical scrollbar to pop in and out of existence. This also pushes the modal left creating an undesirable UI experience.
Reproduced using:
- Bootstrap version: 4.5
- OS: Windows 10
- Browser: Chrome 86.0.4240.75
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (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 >Considerations for Styling a Modal | CSS-Tricks
Typically, if you are on a long, scrolling page, while the modal is open you can still scroll the background, which in most...
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 >How to fight the <body> scroll. First of all - Medium
First of all — WHY one have to fight the scroll? · You shall not be able to click on it. Not be...
Read more >How To Prevent Scrolling The Page On iOS Safari 15 - PQINA
If we show a modal on iOS we need to prevent events inside the modal from interacting with the page behind the modal....
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
I’m currently working around this issue by modifying Bootstrap’s CSS so that the scale animation occurs on the
modal-content
div rather than the usualmodal-dialog
div.Sass:
It only happens when opening dev tools and manually increasing the value for the scale (Closing the dev tools does not reproduce it). Generally, it cannot be reproduced.