Skip to content
Permalink
Browse files

Dialog: ESC key event was not being canceled after it was handled (Fi…

…xed #4922 window.location.reload() doesn't work in dialog's close callback when it's triggered by ESC in Firefox)
  • Loading branch information
btburnett3 committed Feb 22, 2010
1 parent e220284 commit 350853179fc873a2afe6e8d2338a6b9e35303c9c
Showing with 12 additions and 4 deletions.
  1. +12 −4 ui/jquery.ui.dialog.js
@@ -66,8 +66,12 @@ $.widget("ui.dialog", {
// setting tabIndex makes the div focusable
// setting outline to 0 prevents a border on focus in Mozilla
.attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
(options.closeOnEscape && event.keyCode
&& event.keyCode == $.ui.keyCode.ESCAPE && self.close(event));
if (options.closeOnEscape && event.keyCode
&& event.keyCode == $.ui.keyCode.ESCAPE) {

self.close(event);
event.preventDefault();
}
})
.attr({
role: 'dialog',
@@ -614,8 +618,12 @@ $.extend($.ui.dialog.overlay, {

// allow closing by pressing the escape key
$(document).bind('keydown.dialog-overlay', function(event) {
(dialog.options.closeOnEscape && event.keyCode
&& event.keyCode == $.ui.keyCode.ESCAPE && dialog.close(event));
if (dialog.options.closeOnEscape && event.keyCode
&& event.keyCode == $.ui.keyCode.ESCAPE) {

dialog.close(event);
event.preventDefault();
}
});

// handle window resize

0 comments on commit 3508531

Please sign in to comment.
You can’t perform that action at this time.