Opened 8 years ago

Closed 7 years ago

#7523 closed bug (fixed)

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:


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)


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.

Change History (2)

comment:1 Changed 8 years ago by Scott González

Component: ui.coreui.autocomplete

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

Resolution: fixed
Status: newclosed

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

Changeset: 530d4cb40814c68163197f8091322e2258f0e57a

Note: See TracTickets for help on using tickets.