Skip to main content

Search and Top Navigation

#7579 closed bug (fixed)

Opened July 23, 2011 07:34AM UTC

Closed October 12, 2011 08:26PM UTC

autocomplete overwrites input erroneously when user hits ESC before timeout expires

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

See http://jsbin.com/enulud/4 for an example.

As pointed out by gf3 in #jquery, the problem appears to be at:

https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.autocomplete.js#L113

self.term is being used even if it is not set and/or is outdated.

http://jqueryui.com/demos/autocomplete/remote.html

Also has the problem, but a different version of it:

1. Enter 'wh'

2. Wait for the autocomplete list to show up

3. type 'i', then immediately press Escape

4. See that the text input has "wh" rather than "whi"

Possible solution:

Really, the only time that the text should be replaced is after the user has arrowed down into one of the autocomplete results.

https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.autocomplete.js#L212

could set self._value_orig before it replaces it and the escape handler could replace self._value with self._value_orig if it exists.

Attachments (0)
Change History (1)

Changed October 12, 2011 08:26PM UTC by Scott González comment:1

resolution: → fixed
status: newclosed

Autocomplete: Don't react to the escape key if the menu isn't open. Fixes #7579 - autocomplete overwrites input erroneously when user hits ESC before timeout expires.

Changeset: 75415b35eafbd09fbc804d6cfe6d9d6b6b65d17d