Skip to content

Commit

Permalink
Dialog: Set the _isOpen flag immediately in open(). Fixes #8958 - Dia…
Browse files Browse the repository at this point in the history
…log: Double ui-widget-overlay when opening modal dialog triggers an event opening same dialog.
  • Loading branch information
scottgonzalez committed Jan 31, 2013
1 parent 85dfcdf commit 62cda1f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions tests/unit/dialog/dialog_methods.js
Expand Up @@ -193,6 +193,35 @@ test("#6137: dialog('open') causes form elements to reset on IE7", function() {
d1.remove();
});

asyncTest( "#8958: dialog can be opened while opening", function() {

This comment has been minimized.

Copy link
@jzaefferer

jzaefferer Oct 17, 2013

Member

Running the dialog tests from view.jqueryui.com/master in IE8 via BrowserStack, the runner gets stuck on this test. Also observable here: http://swarm.jquery.org/result/991721

This comment has been minimized.

Copy link
@jzaefferer

jzaefferer Nov 15, 2013

Member

This was fixed with ce5539f

expect( 1 );

var element = $( "<div>" ).dialog({
autoOpen: false,
modal: true,
open: function() {
equal( $( ".ui-widget-overlay" ).length, 1 );
start();
}
});

$( "#favorite-animal" )
// We focus the input to start the test. Once it receives focus, the
// dialog will open. Opening the dialog, will cause an element inside
// the dialog to gain focus, thus blurring the input.
.bind( "focus", function() {
element.dialog( "open" );
})
// When the input blurs, the dialog is in the process of opening. We
// try to open the dialog again, to make sure that dialogs properly
// handle a call to the open() method during the process of the dialog
// being opened.
.bind( "blur", function() {
element.dialog( "open" );
})
.focus();
});

test("#5531: dialog width should be at least minWidth on creation", function () {
expect( 4 );
var element = $("<div></div>").dialog({
Expand Down
2 changes: 1 addition & 1 deletion ui/jquery.ui.dialog.js
Expand Up @@ -215,6 +215,7 @@ $.widget( "ui.dialog", {
return;
}

this._isOpen = true;
this.opener = $( this.document[0].activeElement );

this._size();
Expand All @@ -226,7 +227,6 @@ $.widget( "ui.dialog", {
that._trigger("focus");
});

this._isOpen = true;
this._trigger("open");
},

Expand Down

0 comments on commit 62cda1f

Please sign in to comment.