diff --git a/pkg/web/templates/index.html b/pkg/web/templates/index.html
index aeaefa1..47dc344 100644
--- a/pkg/web/templates/index.html
+++ b/pkg/web/templates/index.html
@@ -108,6 +108,10 @@
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
+ body.modal-open {
+ overflow: hidden !important;
+ }
+
/* Custom tooltip styling */
.tooltip {
position: relative;
@@ -660,7 +664,7 @@
-
+
@@ -668,7 +672,7 @@
-
+
@@ -1302,13 +1306,36 @@
refreshData();
}
+ let openModalCount = 0;
+
+ function updateBodyScrollLock() {
+ if (openModalCount > 0) {
+ document.body.classList.add('modal-open');
+ } else {
+ document.body.classList.remove('modal-open');
+ }
+ }
+
// Close modal
function closeModal(modalId) {
- document.getElementById(modalId).classList.add('hidden');
+ var modal = document.getElementById(modalId);
+ if (!modal || modal.classList.contains('hidden')) {
+ return;
+ }
+ modal.classList.add('hidden');
+ openModalCount = Math.max(0, openModalCount - 1);
+ updateBodyScrollLock();
}
// Open modal
function openModal(modalId) {
- document.getElementById(modalId).classList.remove('hidden');
+ var modal = document.getElementById(modalId);
+ if (!modal || !modal.classList.contains('hidden')) {
+ updateBodyScrollLock();
+ return;
+ }
+ modal.classList.remove('hidden');
+ openModalCount += 1;
+ updateBodyScrollLock();
}
// *******************************************************************