Skip to main content

Search and Top Navigation

#5775 closed bug (fixed)

Opened June 28, 2010 02:34AM UTC

Closed July 20, 2010 06:41PM UTC

Last modified August 04, 2010 01:25AM UTC

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:
Blocked by: Blocking:
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.

Attachments (0)
Change History (3)

Changed July 14, 2010 09:28AM UTC by serhii comment:1

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.

Changed July 20, 2010 06:41PM UTC by scottgonzalez comment:2

milestone: TBD1.9
resolution: → fixed
status: newclosed

Fixed in ba09165.

Changed August 04, 2010 01:25AM UTC by scottgonzalez comment:3

milestone: 1.91.8.3