Opened 12 years ago
Closed 12 years ago
#7579 closed bug (fixed)
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:
- Enter 'wh'
- Wait for the autocomplete list to show up
- type 'i', then immediately press Escape
- 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.
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.