New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added new props : autoFocusOption #3484
Added new props : autoFocusOption #3484
Conversation
+1 for this, sorely needed. |
Any idea when this will be merged and released? |
+1, useful functionality, I would like to get information about the merge and release. Thanks a lot. |
Any chances this could be merged in the near future! 🙏 Seems to be very similar to #3324 |
+1 When?) In some cases a workaround can be to add input value to the list as the first option. |
Clicking on the search button takes the user to the search results page. I've added a new result at the top of the results list ('View all search results for *query*'), this is a workaround because the library used here (`react-select`) doesn't allow you to disable autofocussing yet - JedWatson/react-select#3484 Making clicking on the search button work required another workaround that involves storing the query when the input is blurred (due to issues discussed here - JedWatson/react-select#805). This means that clicking on the search button should work as expected but clicking outside the input and then later clicking the search button will go to the search page for the last stored query even though the input is empty. This isn't great but hopefully a rare enough case (why click on the search button for an empty search box?) that it's worth it to have it working like this for the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, really expect for this
+1 We would urgently need this option - any plans when this pr will be merged? |
we're also waiting for this. is there any news on this? |
While it would be great for this PR to be merged, I believe I managed to accomplish this with the following hackery:
There is no longer any default selection, but arrow keying still works. I then also bind to onKeyDown to intercept submission from input and fire submission callback with text directly from input. |
@alisman you have a great but incomplete solution here 🙂The problem is that it doesn't work when you open menu for the first time. Here's the complete: const ref = React.useRef();
React.useEffect(() => {
ref.current.select.getNextFocusedOption = () => null;
}, []);
const options = [
{label: 'Option 1', value: '1'},
{label: 'Option 2', value: '2'},
];
return (
<ReactSelect
ref={ref}
options={options}
/>
); |
PR to be reviewed, duplicate of #3010 |
Hi all, Thanks for your contribution @CharlieBreval! There are a number of pull requests adding this feature - I've since created an up to date PR - #4080, and closed similar pull requests. If I've missed anything, please let me know. Closing this PR in favor of #4080. |
Hello,
Recently, I have been facing a problem : Using React Select without preselection of the first available (focusable) option.
This option didn't exist at all. The problem has been raised in multiples issues :
#2848
Behavior with this option is simple :
1 : Click on the select : No option is focused
2 : Your user starts typing a word, no option is focused until the user do an action for that.