Menu: If the active element no longer exists after a refresh, blur the menu.

This commit is contained in:
Scott González 2012-08-27 08:05:27 -04:00
parent b22e3c36f2
commit 93556a8e18
2 changed files with 5 additions and 2 deletions

View File

@ -482,8 +482,6 @@ $.widget( "ui.autocomplete", {
.empty()
.zIndex( this.element.zIndex() + 1 );
this._renderMenu( ul, items );
// TODO refresh should check if the active item is still in the dom, removing the need for a manual blur
this.menu.blur();
this.menu.refresh();
// size and position menu

View File

@ -319,6 +319,11 @@ $.widget( "ui.menu", {
.prepend( submenuCarat );
menu.attr( "aria-labelledby", item.attr( "id" ) );
});
// If the active item has been removed, blur the menu
if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
this.blur();
}
},
_itemRole: function() {