Selectmenu: fix closing of empty selects

This commit is contained in:
Felix Nagel 2012-12-13 01:12:52 +01:00
parent c69d01bed7
commit 1ea22565d3

View File

@ -222,11 +222,16 @@ $.widget( "ui.selectmenu", {
return; return;
} }
var id = this._getSelectedItem().find( "a" ).attr( "id" );
this.isOpen = false; this.isOpen = false;
this._toggleAttr(); this._toggleAttr();
// check if we have an item to select
if ( this.menuItems ) {
var id = this._getSelectedItem().find( "a" ).attr( "id" );
this.button.attr( "aria-activedescendant", id ); this.button.attr( "aria-activedescendant", id );
this.menu.attr( "aria-activedescendant", id ); this.menu.attr( "aria-activedescendant", id );
}
this._trigger( "close", event ); this._trigger( "close", event );
}, },