Typeahead.js: Autocomplete when pressing Tab in same way it works when pressing Return

Created on 23 May 2013  路  5Comments  路  Source: twitter/typeahead.js

Hi

Would it be possible to amend Typeahead so that a user can start typing, use the down-arrow to navigate to an option and then hit Tab to select that item? Currently this only works by pressing Return. Tab takes the focus to the next tabbable element leaving the text input with what the user typed in only. The desired behaviour would be for the selection of autocomplete option to take place if the user navigates to an option and then presses either Tab or Return.

Thanks
Ste

Most helpful comment

@jharding I think it should be configurable. I have a use case where I have two textboxes beside each other with the autocomplete. I don't want the first value to be selected when the person means to just go to the next textbox.

All 5 comments

Implementing this behavior should be possible. I'll look into doing it some time in the future or if someone wants to work on it, I'll accept a pull request.

Sorry but, can this be implemented as an option? We have a requirement not to auto select the first item when tab is pressed. Otherwise, how can this be achieved?

Probably won't change this to being configurable through an option, but if you want to remove it, just remove tabKeyed from this line.

+1

@jharding I think it should be configurable. I have a use case where I have two textboxes beside each other with the autocomplete. I don't want the first value to be selected when the person means to just go to the next textbox.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thany picture thany  路  10Comments

Neeeeena picture Neeeeena  路  3Comments

GreatPotato picture GreatPotato  路  8Comments

palintropos picture palintropos  路  4Comments

thedavidscherer picture thedavidscherer  路  5Comments