Skip to content

Commit dbb357f

Browse files
committed
better z-index logic for modals
1 parent 11d9e1c commit dbb357f

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/overlay.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export class Overlay extends Events {
2323
}
2424

2525
compile() {
26-
const zIndex = $('body').hasClass('modal-open') ? 1056 : 1055; // apply z-index for up zo 2 levels
26+
let zIndex = 1055; // default bootstrap modal z-index
27+
zIndex += $('.modal:visible').length; // increase zindex based on currently open modals
2728
compile_template(this, `
2829
<div class="modal-wrapper position-absolute" t-elem="wrapper" style="z-index: ${zIndex}">
2930
<div class="modal-backdrop opacity-25" t-elem="backdrop"></div>

treibstoff/bundle/treibstoff.bundle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,8 @@ var ts = (function (exports, $) {
607607
this.is_open = false;
608608
}
609609
compile() {
610-
const zIndex = $('body').hasClass('modal-open') ? 1056 : 1055;
610+
let zIndex = 1055;
611+
zIndex += $('.modal:visible').length;
611612
compile_template(this, `
612613
<div class="modal-wrapper position-absolute" t-elem="wrapper" style="z-index: ${zIndex}">
613614
<div class="modal-backdrop opacity-25" t-elem="backdrop"></div>

0 commit comments

Comments
 (0)