Ticket #5775 (closed bug: fixed)

Opened 4 years ago

Last modified 4 years ago

Change event for Autocomplete Combobox does not work in IE7

Reported by: james Owned by:
Priority: major Milestone: 1.8.3
Component: ui.autocomplete Version: 1.8.2
Keywords: ie7, autocomplete, change, onchange, change event Cc:
Blocking: Blocked by:

Description

The demo code for the autocomplete combobox uses the change event to set the underlying select input elements value:

 http://jqueryui.com/demos/autocomplete/#combobox

This works fine in firefox, but does not work in IE7. Below is an excerpt of the code:

change: function(event, ui) {

if (!ui.item) {

remove invalid value, as it didn't match anything jQuery(this).val(""); return false;

} select.val(ui.item.id); self._trigger("selected", event, { item: select.find("[value='" + ui.item.id + "']")

});

I have worked around this bug by using the selecte event. Either the demo code needs fixing, or more likely: the change event needs testing in IE7.

Cheers.

Change History

comment:1 Changed 4 years ago by serhii

The same happens on IE8 using the mouse to select an item. The change event does not fire because the self.previous value is updated before the call to _change.

On the menu selected event there is some code to return the focus to the autocomplete input while keeping the self.previous value unchanged:

					// only trigger when focus was lost (click on menu)
					var previous = self.previous;
					if ( self.element[0] !== doc.activeElement ) {
						self.element.focus();
						self.previous = previous;
					}

This code works, but after this there is another focus.autocomplete event that changes the self.previous value, breaking the change event on IE.

I've been unable to find where the second focus event comes from.

comment:2 Changed 4 years ago by scott.gonzalez

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from TBD to 1.9

Fixed in  ba09165.

comment:3 Changed 4 years ago by scott.gonzalez

  • Milestone changed from 1.9 to 1.8.3
Note: See TracTickets for help on using tickets.