aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2012-12-13 01:12:52 +0100
committerFelix Nagel <info@felixnagel.com>2012-12-13 01:12:52 +0100
commit1ea22565d33760dfcc6c296b0586e459412c2218 (patch)
treecdae6685f36a1e434489db4ed537bf8098e301b5 /ui
parentc69d01bed74cb0129043ec6b42eb67c29515d0a7 (diff)
downloadjquery-ui-1ea22565d33760dfcc6c296b0586e459412c2218.tar.gz
jquery-ui-1ea22565d33760dfcc6c296b0586e459412c2218.zip
Selectmenu: fix closing of empty selects
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.selectmenu.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js
index 9dcf6469f..2e21391bd 100644
--- a/ui/jquery.ui.selectmenu.js
+++ b/ui/jquery.ui.selectmenu.js
@@ -222,11 +222,16 @@ $.widget( "ui.selectmenu", {
return;
}
- var id = this._getSelectedItem().find( "a" ).attr( "id" );
this.isOpen = false;
this._toggleAttr();
- this.button.attr( "aria-activedescendant", id );
- this.menu.attr( "aria-activedescendant", id );
+
+ // 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.menu.attr( "aria-activedescendant", id );
+ }
+
this._trigger( "close", event );
},