From 1ea22565d33760dfcc6c296b0586e459412c2218 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Thu, 13 Dec 2012 01:12:52 +0100 Subject: [PATCH] Selectmenu: fix closing of empty selects --- ui/jquery.ui.selectmenu.js | 11 ++++++++--- 1 file 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 ); },