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.

Modal backdrop displays over modal in fixed container

See original GitHub issue

Having a “main-container” with

.app-container {
     position: fixed;
     top: 0;
     right: 0;
     bottom: 0;
     left: 0;
     overflow-y: auto;
 }
<div class="app-container">
  <div class="modal">
....
   </div>
</div>

Makes the backdrop position above the modal, blocking everthing.

Plunker: https://plnkr.co/edit/8JvG9eje5FDssHykPwW8?p=preview (With angular where modal.html and modal.ts has code for autoopening modal and app.ts and app.scss has template for main window)

Edit Seems like using .appendTo('body') when opening modal is a workaround, i.e $('#exampleModal').appendTo('body').modal('show');

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
VelkanGkcommented, Feb 11, 2019

Edit Seems like using .appendTo('body') when opening modal is a workaround, i.e $('#exampleModal').appendTo('body').modal('show');

Was the best solution so far. The button that triggers the modal must be changed to a click action with a function containing the lines above.

1reaction
ysdscommented, Feb 10, 2018

This issue has marked as a won’t/can’t fix issue and a duplicate of #22801, #20433 or #3217.

Also in docs:

Modals use position: fixed, which can sometimes be a bit particular about its rendering. Whenever possible, place your modal HTML in a top-level position to avoid potential interference from other elements. You’ll likely run into issues when nesting a .modal within another fixed element.

Another workaround is add z-index: 1050 to your .app-container.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap modal appearing under background - Stack Overflow
If the modal container has a fixed or relative position or is within an element with fixed or relative position this behavior will...
Read more >
Bootstrap Modal Dialog showing under Modal Background
The easiest solution is to move the modal dialog outside of any container and just declare it under the <body> element, or -...
Read more >
Modal - Bootstrap
Modals are built with HTML, CSS, and JavaScript. · Clicking on the modal “backdrop” will automatically close the modal. · Bootstrap only supports...
Read more >
Bootstrap Modal Position - Visual LightBox
- Selecting the modal "backdrop" will quickly finalize the modal. - Bootstrap simply just supports a single modal pane at a time. Embedded...
Read more >
Modal Options - W3Schools Tryit Editor
The backdrop option specifies whether the modal should have a dark overlay (the background color of the current page) or not. Modal with...
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