From c599082eca8bc98bc264a52f873bb6de475ec459 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 10 Jun 2024 11:22:00 +0200 Subject: [PATCH] wip: deal with multiple dialog z-index --- umap/static/umap/js/modules/ui/dialog.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/umap/static/umap/js/modules/ui/dialog.js b/umap/static/umap/js/modules/ui/dialog.js index 417f82bc..01204180 100644 --- a/umap/static/umap/js/modules/ui/dialog.js +++ b/umap/static/umap/js/modules/ui/dialog.js @@ -19,8 +19,18 @@ export default class Dialog { this.container.close() } + currentZIndex() { + return Math.max( + ...Array.from(document.querySelectorAll('dialog')).map( + (el) => window.getComputedStyle(el).getPropertyValue('z-index') || 0 + ) + ) + } + open({ className, content, modal } = {}) { this.container.innerHTML = '' + const currentZIndex = this.currentZIndex() + if (currentZIndex) this.container.style.zIndex = currentZIndex + 1 if (modal) this.container.showModal() else this.container.show() if (className) {