mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Dialog: Don't use ._on() for modal event handlers. Fixes #9048 - Dialog: broken focusin event handler when beforeclose event of a modal opens another modal.
This commit is contained in:
parent
9c6b8f859a
commit
8724092e50
@ -147,4 +147,17 @@ asyncTest( "Prevent tabbing out of dialogs", function() {
|
||||
});
|
||||
});
|
||||
|
||||
asyncTest( "#9048: multiple modal dialogs opened and closed in different order", function() {
|
||||
expect( 1 );
|
||||
$( "#dialog1, #dialog2" ).dialog({ autoOpen: false, modal:true });
|
||||
$( "#dialog1" ).dialog( "open" );
|
||||
$( "#dialog2" ).dialog( "open" );
|
||||
$( "#dialog1" ).dialog( "close" );
|
||||
setTimeout(function() {
|
||||
$( "#dialog2" ).dialog( "close" );
|
||||
$( "#favorite-animal" ).focus();
|
||||
ok( true, "event handlers cleaned up (no errors thrown)" );
|
||||
start();
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
|
6
ui/jquery.ui.dialog.js
vendored
6
ui/jquery.ui.dialog.js
vendored
@ -678,8 +678,7 @@ $.widget( "ui.dialog", {
|
||||
this._delay(function() {
|
||||
// Handle .dialog().dialog("close") (#4065)
|
||||
if ( $.ui.dialog.overlayInstances ) {
|
||||
this._on( this.document, {
|
||||
focusin: function( event ) {
|
||||
this.document.bind( "focusin.dialog", function( event ) {
|
||||
if ( !$( event.target ).closest(".ui-dialog").length &&
|
||||
// TODO: Remove hack when datepicker implements
|
||||
// the .ui-front logic (#8989)
|
||||
@ -688,7 +687,6 @@ $.widget( "ui.dialog", {
|
||||
$(".ui-dialog:visible:last .ui-dialog-content")
|
||||
.data("ui-dialog")._focusTabbable();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -712,7 +710,7 @@ $.widget( "ui.dialog", {
|
||||
$.ui.dialog.overlayInstances--;
|
||||
|
||||
if ( !$.ui.dialog.overlayInstances ) {
|
||||
this._off( this.document, "focusin" );
|
||||
this.document.unbind( "focusin.dialog" );
|
||||
}
|
||||
this.overlay.remove();
|
||||
this.overlay = null;
|
||||
|
Loading…
Reference in New Issue
Block a user