From 67732ee5a65f874626e15c1ded22b9bbcd3dc5f4 Mon Sep 17 00:00:00 2001 From: kborchers Date: Thu, 19 May 2011 08:16:05 -0500 Subject: [PATCH] Dialog: Modified creation of overlay to bind events to the overlay rather than the document object. Fixed #4671 - Modal Dialog disables vertical scroll bar in Chrome & Safari --- ui/jquery.ui.dialog.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index dc2849155e0..031ce68eb41 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -693,13 +693,15 @@ $.extend( $.ui.dialog.overlay, { setTimeout(function() { // handle $(el).dialog().dialog('close') (see #4065) if ( $.ui.dialog.overlay.instances.length ) { - $( document ).bind( $.ui.dialog.overlay.events, function( event ) { - // stop events if the z-index of the target is < the z-index of the overlay - // we cannot return true when we don't want to cancel the event (#3523) - if ( $( event.target ).zIndex() < $.ui.dialog.overlay.maxZ ) { - return false; - } - }); + for( var i = 0; i < $.ui.dialog.overlay.instances.length; i++ ) { + $.ui.dialog.overlay.instances[ i ].bind( $.ui.dialog.overlay.events, function( event ) { + // stop events if the z-index of the target is < the z-index of the overlay + // we cannot return true when we don't want to cancel the event (#3523) + if ( $( event.target ).zIndex() < $.ui.dialog.overlay.maxZ ) { + return false; + } + }); + } } }, 1 );