Skip to content

Commit c5efdda

Browse files
committed
Selectmenu: small fix for _toggleAttr to make sure isOpen is not undefined
1 parent 1fbf5cb commit c5efdda

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ui/jquery.ui.selectmenu.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ $.widget( "ui.selectmenu", {
200200
this.button.trigger( "focus" );
201201
}
202202

203+
this.isOpen = true;
203204
this._toggleAttr();
204205

205206
if ( this.items && !this.options.dropdown ) {
@@ -225,15 +226,14 @@ $.widget( "ui.selectmenu", {
225226
of: this.button
226227
}, this.options.position ));
227228

228-
this.isOpen = true;
229229
this._trigger( "open", event );
230230
}
231231
},
232232

233233
close: function( event ) {
234234
if ( this.isOpen ) {
235-
this._toggleAttr();
236235
this.isOpen = false;
236+
this._toggleAttr();
237237
this._trigger( "close", event );
238238
}
239239
},
@@ -403,11 +403,11 @@ $.widget( "ui.selectmenu", {
403403

404404
_toggleAttr: function(){
405405
if ( this.options.dropdown ) {
406-
this.button.toggleClass( 'ui-corner-top', !this.isOpen ).toggleClass( 'ui-corner-all', this.isOpen );
406+
this.button.toggleClass( 'ui-corner-top', this.isOpen ).toggleClass( 'ui-corner-all', !this.isOpen );
407407
}
408-
this.menuWrap.toggleClass( 'ui-selectmenu-open', !this.isOpen );
409-
this.menu.attr("aria-hidden", this.isOpen);
410-
this.button.attr("aria-expanded", !this.isOpen);
408+
this.menuWrap.toggleClass( 'ui-selectmenu-open', this.isOpen );
409+
this.menu.attr("aria-hidden", !this.isOpen);
410+
this.button.attr("aria-expanded", this.isOpen);
411411
},
412412

413413
_getCreateOptions: function() {

0 commit comments

Comments
 (0)