Skip to content

Commit 0ccc786

Browse files
committed
Autocomplete: Handle IE firing focus events asynchronously. Fixes #6109 - Autocomplete Change event does not fire in IE.
1 parent a3da104 commit 0ccc786

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ui/jquery.ui.autocomplete.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ $.widget( "ui.autocomplete", {
160160
if ( self.element[0] !== doc.activeElement ) {
161161
self.element.focus();
162162
self.previous = previous;
163+
// #6109 - IE triggers two focus events and the second
164+
// is asynchronous, so we need to reset the previous
165+
// term synchronously and asynchronously :-(
166+
setTimeout(function() {
167+
self.previous = previous;
168+
}, 1);
163169
}
164170

165171
if ( false !== self._trigger( "select", event, { item: item } ) ) {

0 commit comments

Comments
 (0)