-
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
Focus and expand the select list #460
Comments
+1 |
1 similar comment
+1 |
I figured out the solution for this. We need to set the this._openAfterFocus = true in the focus() method of select.js |
+1, would be great to merge the solution of @olwen1987 |
Is there a reason the solution of @olwen1987 is not being merged into master? |
The focus function is a little different now. I'm looking at version 1.0.0-beta12 and it references the property "openAfterFocus" to determine if focus() should open the drop down when focus() is called. Try setting the openAfterFocus (not openOnFocus) prop to "true" and see if that has an effect. It still doesn't work for me but that could be due to Redux Form (I'm still investigating but might put it on the backburner for a bit). |
After more testing, I've decided that openAfterFocus works fine on 1.0.0-beta12 if you click on the Select Control. However, if the Select Control receives focus via clicking a label (with a ref) or by pressing tab, then it does not open the menu. Depending on what you're going for UX-wise, this might actually be the desired functionality. To make the menu respect the openAfterFocus for any type of focusing, the Select control needs to be modified or monkey-patched. If you really want to monkey patch it, you can put this code in your Component that contains the Select Component.
There might be a better way to do this but with my limited understanding of the code, it seems to work all right. |
Here's my awful hack to keep the select list open at all times, except when a value is selected (with
|
Could someone clarify the difference between the |
@jkillian Glancing at the code, it seems like openOnFocus will now do what I tried to monkey patch however you might have to set both openAfterFocus as well as openOnFocus to true for this to work (though check both parameters are available in the version you're using) So I guess at the moment, openOnFocus is like "openOnAnyTypeOfFocus" or "alwaysOpenOnFocus" and openAfterFocus is like "openAfterClickToFocus" You might need to experiment/debug to clarify as I haven't had a chance to do that with the new code. |
Thanks for the answer @panetta-net-au! If I encounter anything different in trying it out I'll respond here. Now just wish there was an |
Also, I think the |
Yep |
I just want to note here that behavior is quite opposite right now (v1.2.1). Even with |
Version 1 of react-select is no longer supported. In the best interest of the community we've decided to spend the time we have available on the latest version. We apologise for any inconvenience. Please see: |
When I focus the component instance (
this.refs.mySelectList.focus()
), the list will focus but not expand. Is there a way to also expand the list programatically?The text was updated successfully, but these errors were encountered: