Skip to main content

Search and Top Navigation

#9029 closed bug (fixed)

Opened January 30, 2013 09:12AM UTC

Closed January 30, 2013 01:36PM UTC

Autocomplete: Multiple demo has errors

Reported by: deap82 Owned by:
Priority: minor Milestone: 1.10.1
Component: ui.autocomplete Version: 1.10.0
Keywords: Cc:
Blocked by: Blocking:
Description

There is an error when trying to tab away from a multiple autocomplete decorated textbox, the bug exists in this demo:

http://jqueryui.com/autocomplete/#multiple

Replicate error by typing "ja" in the textbox and then press tab.

The error message is: Uncaught TypeError: Cannot read property 'menu' of undefined

which is caused by the fact that $(this).data("autocomplete") is undefined.

The error resides in the demo codes keydown handler, I have replaced that code with the following:

      	if (event.keyCode === $.ui.keyCode.TAB &&
		$('.ui-autocomplete.ui-menu a.ui-state-focus:visible').length > 0) {
      		event.preventDefault();
      	}

The result is that the default action of pressing tab only will be prevented when an item is actually selected in the suggestion list. This works in my case when I have only one autocomplete textbox within the page. A more general solution is probably needed.

Attachments (0)
Change History (4)

Changed January 30, 2013 01:13PM UTC by tj.vantoll comment:1

resolution: → duplicate
status: newclosed

Duplicate of #8992.

Changed January 30, 2013 01:35PM UTC by scottgonzalez comment:2

resolution: duplicate
status: closedreopened

Changed January 30, 2013 01:35PM UTC by scottgonzalez comment:3

milestone: none1.10.1
status: reopenedopen
summary: Tab error in the autocomplete multiple demoAutocomplete: Multiple demo has errors

Changed January 30, 2013 01:36PM UTC by Scott González comment:4

resolution: → fixed
status: openclosed

Autocomplete: Fix .data() references in demos. Fixes #9029 - Autocomplete: Multiple demo has errors.

Changeset: ceebe07e2c99190030c16b031813ae660d9283d1