Opened 7 years ago

Closed 7 years ago

#9329 closed bug (duplicate)

Autocomplete: Does not display when searching for the same string with a delay

Reported by: garygreen Owned by:
Priority: minor Milestone: none
Component: ui.autocomplete Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:

Description

It's due to the if statement in the following lines of code:

_searchTimeout: function( event ) {
		clearTimeout( this.searching );
		this.searching = this._delay(function() {
			// only search if the value has changed

			if ( this.term !== this._value() ) {
				this.selectedItem = null;
				this.search( null, event );
			}
		}, this.options.delay );
	},

This means that it won't re-display the options if the input is reentered. Try the below fiddle by typing "london" and waiting for the display, click away, re-enter "london" and it won't display.

http://jsfiddle.net/DWqFx/

Change History (2)

comment:1 Changed 7 years ago by tj.vantoll

Status: newopen
Summary: .autocomplete() not searching on same input when using delayAutocomplete: Does not display when searching for the same string with a delay

Here's the same test case with the CSS added: http://jsfiddle.net/tj_vantoll/JeBpz/. This could be especially problematic if there are other potential matches (for example "london2", "london bridge", etc).

I don't think we have to run the search again here, we could probably just add an else that displays the menu, since it should be in the same state as before.

comment:2 Changed 7 years ago by Scott González

Resolution: duplicate
Status: openclosed

Duplicate of #7434.

Note: See TracTickets for help on using tickets.