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

Add Feature to auto focus/open dropdown & Select options #6873

Closed
taqimustafa opened this issue Jul 17, 2017 · 9 comments
Closed

Add Feature to auto focus/open dropdown & Select options #6873

taqimustafa opened this issue Jul 17, 2017 · 9 comments

Comments

@taqimustafa
Copy link

What problem does this feature solve?

Most of the time we need to display the dropdown/Select option to be auto focused. But there is no option to achieve that.

https://github.com/JedWatson/react-select

Similar to this one, see autofocus & openOnFocus property.

What does the proposed API look like?

<Select
  allowClear={this.props.allowClear}
  value={this.props.value}
  autofocus
  openOnFocus
  ...
>
   ...       
</Select>
@afc163
Copy link
Member

afc163 commented Jul 17, 2017

trace #3790

@afc163 afc163 closed this as completed Jul 17, 2017
@MiroslavPetrik
Copy link

MiroslavPetrik commented Jun 13, 2018

Ant uses rc-select underneath. You can use showAction="focus" prop to open the select when it gain's focus. React components select source

@zxqx
Copy link

zxqx commented Jun 18, 2018

@MiroslavPetrik Thanks for pointing this out. I'm curious why this showAction prop isn't documented in the Ant Select documentation. Are some props of rc-select not officially supported by Ant Select?

I'm not sure if this is already documented somewhere in the Ant documentation, but I think at the very least an indication that rc-select is the component used under the hood (with a link to rc-select docs) would be useful. Thoughts?

@divyanshu013
Copy link

I think this should definitely be added to the docs.

@dogahasdemir
Copy link

I wanted to use this feature to enable typing into a select field when moving between fields in a for with Tab button.In fact worked but using mouse click instead of Tab started not working properly(hardly you can find a space in select box that enables you type otherwise you can not type into the field).
Is there any solution for this that anyone came up?

@mti5914-zz
Copy link

mti5914-zz commented Oct 25, 2018

<Select showSearch showAction={['focus', 'click']} />
In IE 11, the Select cannot be closed when it gets focus. If I remove 'focus', it works perfect.
Are there any ideas on this?

joaoprp pushed a commit to joaoprp/ant-design that referenced this issue Nov 14, 2018
…errors when used through antd Select component

The usage of this prop was discussed over ant-design#6873
afc163 pushed a commit that referenced this issue Nov 14, 2018
…errors when used through antd Select component

The usage of this prop was discussed over #6873
@joaoprp
Copy link

joaoprp commented Nov 16, 2018

In the meantime, if anyone using react + typescript wants to use showAction with no declaration issues, you can do something like:

const rcProps = {
    showAction: 'focus'
  };

and then:

<Select
    {...rcProps}
    // your other declared props
>

@ChuckJonas
Copy link
Contributor

If I try to use the `showAction the behavior gets really inconsistent. It sometimes opens when I click the arrow and sometimes it flashes and then closes immediately

@adams-family
Copy link

Very interesting! I like this feature, however, I don't find it documented anywhere. Isn't it supported?

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

10 participants