pbauerochse / searchable-option-list

a jquery plugin for a searchable optionlist
MIT License
79 stars 54 forks source link

how to implement auto-hide when using tab or shift-tab #30

Open tbl0605 opened 8 years ago

tbl0605 commented 8 years ago

Hi, I'm trying to auto-hide the SOL component when I leave the '#my-select' input by using tab or shift-tab. Now I'm doing:

$(function() { $('#my-select').searchableOptionList({ events: { onInitialized: function(sol, items) { this.$input.focusout(function(event) { sol.close(); }); }}}); });

It works nicely when leaving the input '#my-select' but when I "tab" in (or "shift-tab" in) this input again, the options popup shows up but no option can be selected anymore using mouse!

What am I doing wrong?

Thierry.

tbl0605 commented 8 years ago

When I'm using following it works much better, so this report can be closed:

$(function() { $('#my-select').searchableOptionList({ events: { onInitialized: function(sol, items) { this.$input.on('keydown', function(e) { if (e.which == 9) sol.close(); }); }}}); });

But wouldn't it be nice to add a SOL option to implement auto-hide using keyboard (like it's done now using the mouse)?

pbauerochse commented 8 years ago

If already have the ESC key to close the sol container so I guess it would not be that much of a bigger deal to also add the Tab Key ;)

I will keep this issue open and implement that at some point. Thanks for the feedback