]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Fixed the case where you open two modal dialogs and then close the top dialog...
authorScott González <scott.gonzalez@gmail.com>
Thu, 2 Apr 2009 02:00:45 +0000 (02:00 +0000)
committerScott González <scott.gonzalez@gmail.com>
Thu, 2 Apr 2009 02:00:45 +0000 (02:00 +0000)
ui/ui.dialog.js

index cbd0b107c6a4835261530cd383642396c1d7b8f6..d8b348c9b21950f9e075a2c5106efc12c208cebe 100644 (file)
@@ -172,6 +172,17 @@ $.widget("ui.dialog", {
                $.ui.dialog.overlay.resize();
 
                self._isOpen = false;
+               
+               // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
+               if (self.options.modal) {
+                       var maxZ = 0;
+                       $('.ui-dialog').each(function() {
+                               if (this != self.uiDialog[0]) {
+                                       maxZ = Math.max(maxZ, $(this).css('z-index'));
+                               }
+                       });
+                       $.ui.dialog.maxZ = maxZ;
+               }
        },
 
        isOpen: function() {
@@ -572,6 +583,13 @@ $.extend($.ui.dialog.overlay, {
                }
 
                $el.remove();
+               
+               // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
+               var maxZ = 0;
+               $.each(this.instances, function() {
+                       maxZ = Math.max(maxZ, this.css('z-index'));
+               });
+               this.maxZ = maxZ;
        },
 
        height: function() {