select2: Select2 not working with keyboard
Based on https://select2.github.io/examples.html
If you tried clicking on regular select box and press h key then Hawaii selected successfully, but if you clicking on select2 box and press any key, there’s not happen (on Desktop Chrome, Edge and Firefox).
Is there any solution for enable auto searching with focus and type?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (1 by maintainers)
Thank you @teomaragakis & @SgtOddball for your attentions, The keyboard based problem was, after focused on Select2 dropdowns, search is not started with typing…
Scenario
atoz, it’s noting (no searching, no selecting … nothing)AtoZ, it’s noting (no searching, no selecting … nothing)up,down,left,rightnot happenIt just start searching after press
spaceorenterAfter googling for a while, we found Chosen which is fully compatible with keyboard (arrow keys and typing after focus is working awesome).
Thank you in advanced
@SgtOddball I think he means that the focus gets lost after you choose an option (I have the same issue too). When you select a value from the list and the list closes, you lose the focus on the outside element (.select2-container) which means that if you press tab, you won’t move to the next element in the form, but it will take you to the beginning.
Obviously this is wrong from a UX point of view.
Could you confirm the issue? (It can also be seen in the examples page, first instance of select2)
In that case I really don’t follow.
Do you mean to navigate to the select box using keyboard and then keypress or use the mouse to select the box and then start typing?
If you’re using the mouse to click the box then type, it works just fine on my own setup.
It might help if you could provide a snippit of what you’re doing (something like ‘screen to gif’) as well as details such as what version of the browsers your using (ie firefox 47.0, edge 12 etc) that way it’d be easier to figure out whats happening since either it can’t be replicated or the issue is not clearly described.
Do you mean the hidden search box variant? As in this one?
In which case, yes you’ve got a point (I’d guess that without the search there’s no input box to listen to keypresses for) .