-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
explicitly call .blur() on select? #1254
Comments
This is an old issue, but I'd like to see the addition of a |
Hello - In an effort to sustain the We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest version. If you feel this issue / pull request is still relevant and you'd like us to review it, please leave a comment and we'll do our best to get back to you. |
it might be 4 years old, but unless this got fixed: this is technically a UX and accessibility bug. Elements should be assigned focus by the browser, based on what it knows about whether code or a user did something. It should never indiscriminately claim focus on its own. Setting a value on a form element should only set the current value, and do nothing else. |
Thanks @Pomax! |
Greetings @Pomax , This has indeed aged a bit, and I am not able to replicate the issue. In my test setup, I have a react-select and an input.
The test shows that the select-value is set without stealing focus from the input. Please let me know if I am misinterpreting the use-case you are trying to achieve as I would like to have any long standing issues resolved without any loose ends. |
I updated your code to reflect the situation we had and do not see it acting anomalously anymore, so that looks fixed. And on a small React note, if you're already returning a single element (in this case, Thanks for following up! |
We're using react-select as one of the many field types in a form, and our form component has the following simple logic to ensure that if any field is set to "Other", a text field is revealed in which users can fill out their out-of-band choice/reason/etc.
This works perfectly, except when "Other" is chosen in react-select. In that case, React honours the
focus()
call in componentDidUpdate, and then react-select immediately steals focus back, which it should not be doing.Is there a way to tell react-select to stop hogging the limelight?
The text was updated successfully, but these errors were encountered: