question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clicking outside vertically centered Modal with static backdrop results in unwanted vertical scrollbar glitch

See original GitHub issue

Steps 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cduffcommented, Oct 12, 2020

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 usual modal-dialog div.

Sass:

.modal {
  .modal-content {
    transition: transform 0.3s ease-out;
  }
}
.modal.modal-static {
  .modal-dialog {
    transform: none;
  }
  .modal-content {
    transform: scale(1.02);
  }
}
0reactions
rohit2sharma95commented, Feb 10, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found