From 9609fafe93564075493f922eb6ddbbdff4d3f367 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Mon, 15 Jul 2024 13:33:07 -0400 Subject: [PATCH] fix: handle the 'auto' value special case for z-index Fix #1997 --- umap/static/umap/js/modules/ui/dialog.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/umap/static/umap/js/modules/ui/dialog.js b/umap/static/umap/js/modules/ui/dialog.js index 6ad1291f..63414098 100644 --- a/umap/static/umap/js/modules/ui/dialog.js +++ b/umap/static/umap/js/modules/ui/dialog.js @@ -97,9 +97,11 @@ export default class Dialog extends WithTemplate { currentZIndex() { return Math.max( - ...Array.from(document.querySelectorAll('dialog')).map( - (el) => window.getComputedStyle(el).getPropertyValue('z-index') || 0 - ) + ...Array.from(document.querySelectorAll('dialog')).map((el) => { + const zIndex = window.getComputedStyle(el).getPropertyValue('z-index') + if (zIndex === 'auto') return 0 + return zIndex || 0 + }) ) } @@ -127,7 +129,9 @@ export default class Dialog extends WithTemplate { this.hasFormData = this.elements.fieldset.elements.length > 0 const currentZIndex = this.currentZIndex() - if (currentZIndex) this.dialog.style.zIndex = currentZIndex + 1 + if (currentZIndex) { + this.dialog.style.zIndex = currentZIndex + 1 + } this.toggle(true)