Skip to content

Commit c131c95

Browse files
committed
Only increment 'maxZ' when the dialog is open
1 parent f48b4c6 commit c131c95

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
@@ -598,11 +598,14 @@ $.widget("ui.dialog", {
598598
break;
599599
case "zIndex":
600600
if ( value > $.ui.dialog.maxZ ) {
601-
$.ui.dialog.maxZ = value;
602-
603-
if ( self.overlay ) {
604-
$.ui.dialog.maxZ += 1;
605-
$.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ;
601+
// Increment the 'maxZ' counters when this dialog is currently visible
602+
if ( self.isOpen() ) {
603+
$.ui.dialog.maxZ = value;
604+
605+
if ( self.overlay ) {
606+
$.ui.dialog.maxZ += 1;
607+
$.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ;
608+
}
606609
}
607610

608611
value = $.ui.dialog.maxZ;

0 commit comments

Comments
 (0)