Typeahead.js: TAB event doesn't trigger typeahead:selecetd

Created on 4 Mar 2014  路  5Comments  路  Source: twitter/typeahead.js

How to repeat :

 var myCustomCallback = function(eventObject, suggestionObject, datasetName) {
    alert('hello');
 }

myTypeAhead.on('typeahead:selected', myCustomCallback);

Then navigate on your autocomplete field, type few letter so you get a list of items, and then press TAB. It will select the first item, but it won't trigger the :selected event.

Most helpful comment

@jharding it works great with typeahead:autocompleted thanks alot.

All 5 comments

This would be great as an option. I am sure some people might not want TAB to trigger selected, but I (and apparently the OP) would find it useful.

Maybe an addition to "autoselect" where TAB could also be used in addition to "ENTER"

I was asked about this feature last week. It would be very nice to have.

It won't trigger typeahead:selected because nothing was selected. Instead, the value of the input control was updated to be whatever the value of the showing hint was. You can capture this event by listening for typeahead:autocompleted.

Maybe an addition to "autoselect" where TAB could also be used in addition to "ENTER"

I'm actually hoping to kill off the existing, half-baked autoselect functionality in the existing typeahead.js jQuery plugin. I want the scope of the existing plugin to be for search input controls that accept free-form values i.e. don't have to originate from a suggestion. I realize a bunch of people want autoselect functionality though so what I'd like to do is build an additional plugin that's meant to behave as an advanced select control. There's no timeframe for any of this, but I figured I'd share my plans anyways.

I am not sure why this has been closed. Is it now implemented ?

@jharding it works great with typeahead:autocompleted thanks alot.

Was this page helpful?
0 / 5 - 0 ratings