Skip to content
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

Match the right option when hit 'Enter'? #19

Closed
fraserxu opened this issue Nov 21, 2014 · 3 comments
Closed

Match the right option when hit 'Enter'? #19

fraserxu opened this issue Nov 21, 2014 · 3 comments

Comments

@fraserxu
Copy link
Contributor

When user type in the input, if he knows what to type, he may expect to select the right option when type in the value and hit Enter.

For example, If there's a list of countries I need to select ['China', 'Japan', 'USA'], when I finish typing China and I expect to select China when I hit Enter. Currently I need to arrow key down and select it or by mouse click.

@JedWatson
Copy link
Owner

This was surprisingly tricky to implement!

I had to rewrite the way focusedOptions were calculated, moving them from render-time to state, so we can always check when updating the inputValue that the focusedOption is correctly set to one of the options that will appear.

I cleaned up a number of other minor things I found at the same time relating to consistent option focus management.

It should all be working properly now, published with v0.2.6.

@fraserxu
Copy link
Contributor Author

Just tested in my app, works like a charm! Thanks!

@jpsfs
Copy link

jpsfs commented May 16, 2015

Hi!

Sorry for digging-up this topic but although I understand the feature, I have a situation where this doesn't apply well.

I have a situation where I need something like the google autocomplete feature, where the user will type something but I don't want to pre-select anything. Do you think it's possible to provide a flag to enable/disable this behavior?

Cheers!

bkoltai pushed a commit to bkoltai/react-select that referenced this issue Sep 20, 2017
Fix option group heading being cut off by scroll when menu opens
Methuselah96 added a commit to Methuselah96/react-select that referenced this issue Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants