Skip to content

Commit 156df8f

Browse files
committed
Only increment 'maxZ' when the dialog is open
1 parent d9750c8 commit 156df8f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

ui/jquery.ui.dialog.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -597,11 +597,14 @@ $.widget("ui.dialog", {
597597
break;
598598
case "zIndex":
599599
if ( value > $.ui.dialog.maxZ ) {
600-
$.ui.dialog.maxZ = value;
601-
602-
if ( self.overlay ) {
603-
$.ui.dialog.maxZ += 1;
604-
$.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ;
600+
// Increment the 'maxZ' counters when this dialog is currently visible
601+
if ( self.isOpen() ) {
602+
$.ui.dialog.maxZ = value;
603+
604+
if ( self.overlay ) {
605+
$.ui.dialog.maxZ += 1;
606+
$.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ;
607+
}
605608
}
606609

607610
value = $.ui.dialog.maxZ;

0 commit comments

Comments
 (0)