diff options
author | Jay Merrifield <fracmak@gmail.com> | 2011-03-08 09:42:10 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-03-08 09:42:10 -0500 |
commit | f9996682b5739661c21548f0de3d4c4883c5119d (patch) | |
tree | c2a20c11b85a4d6ced5ebe6a224e7f22c8c6f527 /ui/jquery.ui.dialog.js | |
parent | 3a0ec399cdd19c7e7b11934aef559cfa6b8f8258 (diff) | |
download | jquery-ui-f9996682b5739661c21548f0de3d4c4883c5119d.tar.gz jquery-ui-f9996682b5739661c21548f0de3d4c4883c5119d.zip |
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.
Diffstat (limited to 'ui/jquery.ui.dialog.js')
-rw-r--r-- | ui/jquery.ui.dialog.js | 4 |
1 files changed, 2 insertions, 2 deletions
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 ); |