Skip to main content

Search and Top Navigation

#9740 closed bug (duplicate)

Opened January 14, 2014 04:26PM UTC

Closed January 15, 2014 03:12AM UTC

Autocomplete doesn't keep its internal state consistent with jQuery val calls

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

Manipulating the contents of an input element with an autocomplete field attached using jQuery.val does not update the autocomplete's internal "term" variable.

JSFiddle here: http://jsfiddle.net/qbwdm/

Reproduction steps:

  • Type "Hello" into the input box
  • Wait for the drop-down
  • Press enter
  • Value is cleared, drop-down disappears
  • Select the input box
  • Type "Hello" again (fairly quickly)

Expected:

  • Drop-down appears with the correct options

Actual:

  • Drop-down doesn't appear

It's because the check in the _searchTimeout (if(this.term !== this._value()) fails, as the internal value was not updated when the .val("") call was made.

Attachments (0)
Change History (3)

Changed January 14, 2014 04:41PM UTC by emmerich comment:1

Apologies, the ticket seems to has lost some of my formatting around the repro steps.

Changed January 15, 2014 02:54AM UTC by tj.vantoll comment:2

description: Manipulating the contents of an input element with an autocomplete field attached using jQuery.val does not update the autocomplete's internal "term" variable. \ \ JSFiddle here: http://jsfiddle.net/qbwdm/ \ \ Reproduction steps: \ Type "Hello" into the input box \ Wait for the drop-down \ Press enter \ Value is cleared, drop-down disappears \ Select the input box \ Type "Hello" again (fairly quickly) \ \ Expected: \ Drop-down appears with the correct options \ \ Actual: \ Drop-down doesn't appear \ \ It's because the check in the _searchTimeout (if(this.term !== this._value()) fails, as the internal value was not updated when the .val("") call was made. \ Manipulating the contents of an input element with an autocomplete field attached using jQuery.val does not update the autocomplete's internal "term" variable. \ \ JSFiddle here: http://jsfiddle.net/qbwdm/ \ \ Reproduction steps: \ * Type "Hello" into the input box \ * Wait for the drop-down \ * Press enter \ * Value is cleared, drop-down disappears \ * Select the input box \ * Type "Hello" again (fairly quickly) \ \ Expected: \ * Drop-down appears with the correct options \ \ Actual: \ * Drop-down doesn't appear \ \ It's because the check in the _searchTimeout (if(this.term !== this._value()) fails, as the internal value was not updated when the .val("") call was made. \

Changed January 15, 2014 03:12AM UTC by tj.vantoll comment:3

resolution: → duplicate
status: newclosed

Duplicate of #7434.