Skip to main content

Search and Top Navigation

#7523 closed bug (fixed)

Opened July 02, 2011 05:47PM UTC

Closed February 11, 2012 03:13PM UTC

Autocomplete cancel pending request when text changes below minLength

Reported by: stafil Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.autocomplete Version: 1.8.14
Keywords: Cc:
Blocked by: Blocking:
Description

Let say we have an autocomplete with miLenght 4.

User enters the test "This". This will trigger a call to the registered "source" callback.

Now if the user hits backspace and deletes the text before callback returns the results, a pop-down will still appear with the auto-complete results for "This" although the textbox is empty.

This is because when the text goes bellow minLenght we do:

<snip>

search:function(a,b) {

a=a!=null?a:this.element.val();

this.term=this.element.val();

if(a.length<this.options.minLength)return this.close(b);

clearTimeout(this.closing);

if(this._trigger("search",b)!==false)return this._search(a)

</snip>

So when the user modifies the text we call "search". Since length is less that minLength we will call this.close(). However the close will not call the registered callback because the element is not visible yet.

Suggested solution would include either a) provide a new callback to notify the user to cancel the pending request or call the close anyway. The former looks more suitable.

Attachments (0)
Change History (2)

Changed August 09, 2011 04:27PM UTC by scottgonzalez comment:1

component: ui.coreui.autocomplete

Changed February 11, 2012 03:13PM UTC by Scott González comment:2

resolution: → fixed
status: newclosed

Autocomplete: Cancel search when closing the menu. Fixes #7523 - Autocomplete cancel pending request when text changes below minLength.

Changeset: 530d4cb40814c68163197f8091322e2258f0e57a