LeaVerou / awesomplete

Ultra lightweight, usable, beautiful autocomplete with zero dependencies.
http://leaverou.github.io/awesomplete/
MIT License
6.95k stars 609 forks source link

tabSelect: how to avoid change of focus on tab? #17198

Open mbaas2 opened 4 years ago

mbaas2 commented 4 years ago

I am using the awesome awesomplete on a wide input-field where it would make perfect sense to use it several times. To make the keyboard-lovers happy, I have set tabSelect:true and that works fine - but now Tab changes the focus, which is not so nice.

How can that be avoided...either with any of awesomeplete's options or JS?

Fiddle: https://jsfiddle.net/mbaas/e9xy8rbf/

bbenjamin commented 4 years ago

Hi @mbaas2, is there a particular reason you need to do this by tab as opposed to the arrow keys? From an accessibility standpoint, the behavior you're reporting is desirable. Keyboard-only users already expect suggestions to be selectable via arrow keys. They should also be empowered to switch focus via the tab key whenever they wish. This ability would be compromised if it were disallowed while suggestions are present.

mbaas2 commented 3 years ago

Sorry @bbenjamin , I totally missed your question and thereforedid not reply :(

I agree that Tab should by default change focus to the next control. But NOT so, when it used to select an element. When the awesomeplete-list had been opened and tab is used to select the current element, the list should be clodes (as it is), active element should be selected and focus should remain on the input. Such a behviour would also be compatible with regular select-controls!