react-select icon indicating copy to clipboard operation
react-select copied to clipboard

Open options on focus

Open narvoxx opened this issue 10 years ago • 5 comments

For context: I am using this component in a form. When clicking a label in a form the expected behavior is that the corresponding input gets the focus. This can be achieved by adding inputProps: {id: 'someId'} to the select component.

Now, using this behavior I need the options menu to open when the component gets focus this way. If I understand the component correctly this is currently not possible. It was a simple change locally but I haven't made a PR yet, as I'm not even sure if this is behavior you want to support.

(Also somewhat relevant: getting focus by clicking the corresponding label only works if the component is searchable since it doesn't render an input field to reference if it isn't. This probably needs its own issue though)

narvoxx avatar Apr 12 '16 08:04 narvoxx

In think the default behaviour for an HTML standard select input is to simply receive focus and not open the menu. On standard select inputs, the menu opens when you either click the element or press a keyboard arrow button once the element has focus.

The requirement you indicate above, while is a nice to have, would maybe break the default accessible behaviour for select boxes?

rimraf avatar Apr 13 '16 11:04 rimraf

Yes, opening the menu is certainly not default behaviour but I need it to happen somehow. I made a PR for this (it's a small change, just an option): https://github.com/JedWatson/react-select/pull/891 So it wouldn't be on by default. I couldn't really figure out a way to do this without adding a prop.

narvoxx avatar Apr 14 '16 07:04 narvoxx

Just wanted to say this seems fixed? I was able to get it to work with openOnFocus={true}. I think this is a good option to have because it might not be obvious that there are options to pick from otherwise.

SachaG avatar May 04 '17 06:05 SachaG

@SachaG

I was able to get it to work with openOnFocus={true}.

I think you meant openMenuOnFocus={true}. openOnFocus is not any option.

bhch avatar Jun 09 '19 13:06 bhch

Hello -

In an effort to sustain the react-select project going forward, we're closing old issues.

We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our efforts towards the current major version.

If you aren't using the latest version of react-select please consider upgrading to see if it resolves any issues you're having.

However, if you feel this issue 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!

bladey avatar May 28 '20 03:05 bladey