Allow searching for strings with spaces and for substrings
This is a question/request, but I am happy to try to contribute if you can point me in the right direction :)
I notice when using useSelect, if I have a number of entries in the Select dropdown like "San Francisco", "San Diego", and "San Antonio", If I type "San F", it doesn't select the appropriate entry because the space key causes the dropdown to close. So - is there a way to prevent this to allow for searching names with spaces? Is this desired by default, or is there some reason it can't be an option (if it isn't the default behavior)? My thinking is to treat the space character as it currently is treated, unless it comes within 1s after a different keystroke that yielded a matching entry in the select control.
Similar question: if I know all my cities start with 'San', I might just search with 'franci', and expect it to select "San Francisco" as it's the only one containing that substring. Is this behavior somehow already supported? Can/should it be?
Again I haven't contributed to downshift before, but I'm happy to give it a crack, if you can point me toward where I can find the relevant logic!
Hi! This is a great catch!
I think that we should check, on spacebar, if we have any input value, and if we do, we should add the space to the input value, instead of performing the selection.
This should be fixable in the useSelect reducer. It should also contain unit tests, and I think it could be pretty straightforward to code.
Want to give it a try?
Sure, I'll give it a go :)
Is this still open? I'd like to work on it if so
I didn't find time for this after all, so as far as I know it's available
On Tue, Apr 12, 2022, 6:27 PM Leonard Kioi kinyanjui < @.***> wrote:
Is this still open? I'd like to work on it if so
— Reply to this email directly, view it on GitHub https://github.com/downshift-js/downshift/issues/1339#issuecomment-1096436362, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPHN3OFP7CC4IZB6BW6V4LVEU6WNANCNFSM5IOZFYKA . You are receiving this because you authored the thread.Message ID: @.***>
@silviuaavram how do i manually test my changes in the browser while developing locally?
there is npm run docs:dev to start docusaurus with the local code.