r2431 - Dialog: Fixed the case where you open two modal dialogs and then close the top dialog and...

r2431 - Dialog: Fixed the case where you open two modal dialogs and then close the top dialog and...


Author: scott.gonzalez
Date: Wed Apr 1 19:00:45 2009
New Revision: 2431
Modified:
trunk/ui/ui.dialog.js
Log:
Dialog: Fixed the case where you open two modal dialogs and then close the
top dialog and inputs in the first dialog were no longer usable - Fixes
#4309.
Modified: trunk/ui/ui.dialog.js
==============================================================================
--- trunk/ui/ui.dialog.js    (original)
+++ trunk/ui/ui.dialog.js    Wed Apr 1 19:00:45 2009
@@ -172,6 +172,17 @@
        $.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 @@
        }
        $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() {