aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/jquery.ui.autocomplete.js2
-rw-r--r--ui/jquery.ui.menu.js5
2 files changed, 5 insertions, 2 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index da10d82c5..80778f908 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -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
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 78b602cce..333bc9a38 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -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() {