diff --git a/static/js/common.js b/static/js/common.js index 802a9b73..12005bee 100644 --- a/static/js/common.js +++ b/static/js/common.js @@ -1,6 +1,6 @@ // Fix bootstrap backdrop stacking when having multiple modals $(document).on('show.bs.modal', '.modal', function() { - const zIndex = 1040 + 10 * $('.modal:visible').length; + const zIndex = 10 + Math.max(...Array.from(document.querySelectorAll('*')).map((el) => +el.style.zIndex)); $(this).css('z-index', zIndex); setTimeout(() => $('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack')); });