Skip to main content

Search and Top Navigation

#6661 closed bug (fixed)

Opened November 17, 2010 01:15AM UTC

Closed November 19, 2010 09:19PM UTC

Last modified December 08, 2010 06:38PM UTC

Autocomplete: Tab on multiple Autocomplete should not change focus after selecting

Reported by: james.a.rosen@gmail.com Owned by:
Priority: minor Milestone: 1.8.7
Component: ui.autocomplete Version: 1.8.6
Keywords: Cc:
Blocked by: Blocking:
Description

1. Create a multiple-autocomplete (or go to http://jqueryui.com/demos/autocomplete/#multiple).

2. Type the beginning of a valid entry (e.g. "ja")

3. Press the down arrow to highlight the first entry

4. Press TAB

What happens:

the entry is selected

the autocomplete panel closes

a separater is insert into the autocomplete input

focus moves to the next form element or link.

What should happen:

the entry is selected

the autocomplete panel closes

a separater is insert into the autocomplete input

(focus remains in the autocomplete input, awaiting the next item)

NB: a _second_ TAB press, when the panel isn't open, _should_ change focus.

The problem lies in these lines:

//passthrough - ENTER and TAB both select the current element

case keyCode.TAB:

if ( !self.menu.active ) {

return;

}

self.menu.select();

break;

If self.menu.active is true, the event's default behavior should be prevented, just like in the case for keyCode.ENTER.

Attachments (0)
Change History (5)

Changed November 17, 2010 11:37PM UTC by james.a.rosen@gmail.com comment:1

Now that I look at the example more closely, it seems to me that the desired behavior is in the example's "select" function rather than in the library itself. Indeed, adding

event.preventDefault();

to the beginning of the example's "select" function works as expected. Thus, the question is now:

1. should the user who wants the "multiple" functionality include event.preventDefault()

or

2. is there a bug in the handling of the return value -- specifically, is returning false not properly preventing the event's default behavior.

Changed November 18, 2010 12:08AM UTC by james.a.rosen@gmail.com comment:2

If option 1 is the case, see https://github.com/jamesarosen/jquery-ui/tree/6661_fix_1 for a fix to the demo.

If option 2 is the case, see https://github.com/jamesarosen/jquery-ui/tree/6661_fix_2 for a fix to the autocomplete library itself.

Changed November 19, 2010 09:18PM UTC by scottgonzalez comment:3

milestone: TBD1.9
status: newopen
summary: Tab on multiple Autocomplete should not change focus after selectingAutocomplete: Tab on multiple Autocomplete should not change focus after selecting

Changed November 19, 2010 09:19PM UTC by Scott González comment:4

resolution: → fixed
status: openclosed

Autocomplete multiple demos: Don't leave the field when tabbing while the menu is open. Fixes #6661 - Autocomplete: Tab on multiple Autocomplete should not change focus after selecting.

Changeset: 46376958940fa7823c2e5ef4fb15b87c7d2f47db

Changed December 08, 2010 06:38PM UTC by scottgonzalez comment:5

milestone: 1.91.8.7