From f9996682b5739661c21548f0de3d4c4883c5119d Mon Sep 17 00:00:00 2001 From: Jay Merrifield Date: Tue, 8 Mar 2011 09:42:10 -0500 Subject: Dialog: Before handling escape key presses, check if the default action has been prevented. Fixes #6966 - Pressing ESC on dialog when 2 dialogs are open closes both dialogs. --- ui/jquery.ui.dialog.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/jquery.ui.dialog.js') diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 493783896..c14237b6a 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -97,7 +97,7 @@ $.widget("ui.dialog", { // TODO: move to stylesheet .css( "outline", 0 ) .keydown(function( event ) { - if ( options.closeOnEscape && event.keyCode && + if ( options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && event.keyCode === $.ui.keyCode.ESCAPE ) { self.close( event ); event.preventDefault(); @@ -699,7 +699,7 @@ $.extend( $.ui.dialog.overlay, { // allow closing by pressing the escape key $( document ).bind( "keydown.dialog-overlay", function( event ) { - if ( dialog.options.closeOnEscape && event.keyCode && + if ( dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && event.keyCode === $.ui.keyCode.ESCAPE ) { dialog.close( event ); -- cgit v1.2.3