Ticket #6109 (closed bug: fixed)
Autocomplete Change event does not fire in IE
| Reported by: | Kryal | Owned by: | |
|---|---|---|---|
| Priority: | critical | Milestone: | 1.8.6 |
| Component: | ui.autocomplete | Version: | 1.8.5 |
| Keywords: | autocomplete change event mouse | Cc: | |
| Blocking: | Blocked by: |
Description
When using the mouse to select an item in the autocomplete menu, a resulting 'change' event does not occur (only tested in IE). This is because the focus.autocomplete event fires twice after an item has been selected.
So first, menu.select fires:
Always true because menu was just clicked therefore, menu has focus and not the input field.
if ( self.element[0] !== doc.activeElement ) {
self.element.focus(); Fires focus.autocomplete which sets previous
self.previous = previous; Re-sets previous value after focus event
}
Nothing wrong here, except that the focus event fires again. This time, the event comes from the browser and not jQuery. So:
Script focus: sets previous (user-typed value)
Following script: Re-set prevous (expected to end here)
Browser focus: sets previous (which is now the selected value)
Therefore, when the blur event fires on the input field the code thinks that the value hasn't changed, and doesn't trigger the change event.
Change History
comment:1 follow-up: ↓ 2 Changed 3 years ago by scott.gonzalez
- Priority changed from minor to critical
- Milestone changed from TBD to 1.9
comment:2 in reply to: ↑ 1 Changed 3 years ago by scott.gonzalez
Replying to scott.gonzalez:
Works in Chome, Firefox, Opera, IE9b.
It's actually broken in IE9b as well, not sure why I thought it was working there before
comment:3 Changed 3 years ago by scott.gonzalez
The problem is that when we trigger the focus event on selection, IE ends up triggering a native focus event asynchronously. Because the second event occurs asynchronously, our attempt to override the value of the previous property occurs too early.
comment:4 Changed 3 years ago by scott.gonzalez
- Status changed from new to closed
- Resolution set to fixed
Fixed in 0ccc786.
comment:6 Changed 3 years ago by Scott González
Autocomplete: Handle IE firing focus events asynchronously. Fixes #6109 - Autocomplete Change event does not fire in IE.
Changeset: 0ccc78698b55d5e1bc336bb754b546a9ad19ea5c


Works in Chome, Firefox, Opera, IE9b.
Broken in IE6-8.