mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Dialog: ESC key event was not being canceled after it was handled (Fixed #4922 window.location.reload() doesn't work in dialog's close callback when it's triggered by ESC in Firefox)
This commit is contained in:
parent
e2202847c6
commit
350853179f
16
ui/jquery.ui.dialog.js
vendored
16
ui/jquery.ui.dialog.js
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user