Ticket #6661 (closed bug: fixed)
Autocomplete: Tab on multiple Autocomplete should not change focus after selecting
| Reported by: | james.a.rosen@… | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.8.7 |
| Component: | ui.autocomplete | Version: | 1.8.6 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
- Create a multiple-autocomplete (or go to http://jqueryui.com/demos/autocomplete/#multiple).
- Type the beginning of a valid entry (e.g. "ja")
- Press the down arrow to highlight the first entry
- 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.
Change History
comment:2 Changed 3 years ago by james.a.rosen@…
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.
comment:3 Changed 3 years ago by scott.gonzalez
- Status changed from new to open
- Summary changed from Tab on multiple Autocomplete should not change focus after selecting to Autocomplete: Tab on multiple Autocomplete should not change focus after selecting
- Milestone changed from TBD to 1.9
comment:4 Changed 3 years ago by Scott González
- Status changed from open to closed
- Resolution set to fixed
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


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:
or