Skip to content

Commit

Permalink
Autocomplete: Deactivate menu on close.
Browse files Browse the repository at this point in the history
Fixes #5205 - Autocomplete: blur causes last active menu item to be selected.
  • Loading branch information
scottgonzalez committed Feb 20, 2010
1 parent 74120e0 commit 0292c34
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ui/jquery.ui.autocomplete.js
Expand Up @@ -50,11 +50,11 @@ $.widget( "ui.autocomplete", {
break;
case keyCode.ENTER:
// when menu is open or has focus
if ( self.menu && self.menu.active ) {
if ( self.menu.active ) {
event.preventDefault();
}
case keyCode.TAB:
if ( !self.menu || !self.menu.active ) {
if ( !self.menu.active ) {
return;
}
self.menu.select();
Expand Down Expand Up @@ -209,6 +209,7 @@ $.widget( "ui.autocomplete", {
if ( this.menu.element.is(":visible") ) {
this._trigger( "close", event );
this.menu.element.hide();
this.menu.deactivate();
}
if ( this.previous != this.element.val() ) {
this._trigger( "change", event );
Expand Down

0 comments on commit 0292c34

Please sign in to comment.