naive-ui
naive-ui copied to clipboard
fix: add proper tabindex when filterable
Currently, when a Select
is filterable you cannot reach the filter via tab control. This PR will add a proper tabindex
to the inputs.
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
π Inspect: https://vercel.com/tusimple/naive-ui/DBX6EhbUz9J8rrULW3nbJHneC7V6
β
Preview: https://naive-ui-git-fork-jaulz-fix-add-proper-tabindex-tusimple.vercel.app
Codecov Report
Merging #2334 (dfeec06) into main (875b836) will decrease coverage by
0.01%
. The diff coverage is37.50%
.
@@ Coverage Diff @@
## main #2334 +/- ##
==========================================
- Coverage 63.40% 63.39% -0.02%
==========================================
Files 946 946
Lines 19261 19266 +5
Branches 4890 4893 +3
==========================================
+ Hits 12212 12213 +1
- Misses 5881 5885 +4
Partials 1168 1168
Impacted Files | Coverage Ξ | |
---|---|---|
src/_internal/selection/src/Selection.tsx | 39.22% <37.50%> (-0.43%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Ξ = absolute <relative> (impact)
,ΓΈ = not affected
,? = missing data
Powered by Codecov. Last update 875b836...dfeec06. Read the comment docs.
You can open select by pressing enter if it's focused.
I make lazy focus intentionally. Is the behavior problematic?
For normal selects it's fine but if the select is filterable I expect the input to be "tabbable" because I just want to type and select the input that matches my input. In my case I have a select that lets you pick your city from Google Places API. The options are requested on demand as the user types and there shouldn't be the possibility to enter free text.
Can you rebase it? I want to see vercel preview.
@07akioni here you go π
Normal select's tab focusing is broken.
Hm, what's not working for you? I can still focus the tab and press enter to open it.
Tab focus this
@07akioni sorry for the issue I missed that before. I think now it works fine and whenever a select is filterable you can tab properly and can start immediately typing.
After esc is pressed in filterable select, the select box should still be focused.
I think maybe provide a prop to let user choose whether to focus input immediately is better.
Okay, sure. Any suggestion for the name of the prop? π
Okay, sure. Any suggestion for the name of the prop? π
Maybe focus-input-when-filterable
? Not quite sure.