Select component should capture keyboard input
See original GitHub issueI believe the select component should mimic the native HTML select component. ~A core aspect of this is allowing the user to select an option with a keypress and using arrow keys to move up and down the list of options. Selection is done by pressing space
or enter
.~ The component doesn’t let you scroll to the option by pressing the letter key associated with the option.
Example: https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:12 (9 by maintainers)
Top Results From Across the Web
<select>: The HTML Select element - HTML - MDN Web Docs
Selecting multiple options · Focusing on the <select> element (e.g. using Tab ). · Holding down the Ctrl key then using the Up...
Read more >Capture key press without placing an input element on the ...
How to capture key press, e.g., Ctrl+Z, without placing an input element on the page in JavaScript? Seems that in IE, keypress and...
Read more >Implement Keyboard Events in React - Pluralsight
You can listen for keydown and keyup events, which indicate when a user presses or releases keyboard keys.
Read more >How to Handle Keyboard Input Events in React TypeScript ...
When dealing with user interactions, you often need to handle some user events like mouse clicks, keyboard input, etc.
Read more >Building accessible Select component in React - Medium
Select components are everywhere on the internet. ... On Windows, you can turn on Narrator using Windows Key + Ctrl + Enter.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ShimiSun - You’re right! It actually does mimic the native HTML element for the arrow keys and the select.
I think where it breaks from the native HTML Select is when I do a keypress. If I have a list of States and hit the letter C, it should take me to the first option with the letter C.
As mentioned in #5264 this issue has been fixed. Here is a video demonstrating navigating the select with the keyboard, pressing the ‘m’ and then ‘z’ keys and the select correctly scrolling to both of them.