Open aaroncawte opened 3 years ago
@aaroncawte Ah, hm. Sounds like a good idea. Thanks for the feedback!
@tbleckert - I'm trying to achieve something similar where I just want to start typing and press Enter without having to navigate down into the dropdown list (My first option in my dropdown is "show all results" for whatever you are searching).
If this issue is still open, do you know another way to handle this?
I've made a little hack that, when you search, triggers a simulated keydown event if the "highlighted" prop is not set
<SelectSearch
renderValue={(valueProps, snapshot, className) => (
<input {...valueProps} onKeyPress={(e) => {
if(snapshot.highlighted < 0) {
valueProps.onKeyDown( { key: "down", preventDefault: () => {1} } )
}
} />
)}}
/>
cc: @cbaucom
In the Single select - Search example, if you type a substring of your desired option and press Enter, it closes the selector with no change in selection (still nothing or the previous selection).
It would be really cool if pressing Enter would automatically highlight and select the top result, while at the moment you must press Down to highlight it then press Enter to submit.