Skip to content
Permalink
Browse files

Autocomplete: Making sure we do not show search menu after a blur. Fi…

…xed #7423 - Tab out of autocomplete with remote source can leave menu showing.
  • Loading branch information...
spekary committed May 31, 2011
1 parent 2a27499 commit d4257dcde7e49639edbf2a4fd7eb8c6c0254cd97
Showing with 13 additions and 9 deletions.
  1. +13 −9 ui/jquery.ui.autocomplete.js
@@ -169,6 +169,7 @@ $.widget( "ui.autocomplete", {
}

clearTimeout( self.searching );
self.cancelSearch = true; // cancel pending search results
// clicks on the menu (or a button to trigger a search) will cause a blur event
self.closing = setTimeout(function() {
self.close( event );
@@ -354,20 +355,23 @@ $.widget( "ui.autocomplete", {
_search: function( value ) {
this.pending++;
this.element.addClass( "ui-autocomplete-loading" );
this.cancelSearch = false;

this.source( { term: value }, this.response );
},

_response: function( content ) {
if ( content ) {
content = this._normalize( content );
}
this._trigger( "response", null, { content: content } );
if ( !this.options.disabled && content && content.length ) {
this._suggest( content );
this._trigger( "open" );
} else {
this.close();
if (!this.cancelSearch) {
if ( content ) {
content = this._normalize( content );
}
this._trigger( "response", null, { content: content } );
if ( !this.options.disabled && content && content.length ) {
this._suggest( content );
this._trigger( "open" );
} else {
this.close();
}
}
this.pending--;
if ( !this.pending ) {

0 comments on commit d4257dc

Please sign in to comment.
You can’t perform that action at this time.