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
When tabbing and changing focus from and input to a Select component (With the search option activated) you are not able to type #8269
Comments
You need press Enter or ⬇ to enter search mode. |
I was thinking this is a bug at first, but after look into the source code, It's more like a intended behavior. |
I think we can improve this behavior. |
I don't know if you are aware but, Select component use rc-select that admits this behavior of letting you type when you tab between field. You can try it in: |
@Sokal21 multiple select will let you type, but a single select with search can not type. |
http://react-component.github.io/select/examples/combobox.html I think this is the desired behaviour. edit: It should not be able to input anything other the select options. |
Any progress? Same issue here |
I think should enter search mode when focus. |
Is there a plan to solve this issue? |
Hmm... now I realize that this is not a good idea, Select should not open the dropdown automatically when focus. There are some solutions for discuss:
|
If we move the search box into the popup, it won't be an issue. |
Why is it "not a good idea"? Could you elaborate please? |
@ecgan http://react-component.github.io/select/examples/single.html you can try test with the native select. User press tab to focus not represent he want open the dropdown, maybe he just want press tab again to focus next input. |
@yutingzhao1991 , The issue with Ant Design Select component is it doesn't do that; we have to press Enter or the Down arrow to open the dropdown, then only we can type to filter and select the options. It feels less intuitive to me. Do you think it would be good to make Ant Design Select component to follow the native select behavior? Or am I missing something? |
@afc163 , |
To be honest, i was expecting the standard behaviour: if you give the focus to a select (showSearch) it do the same... any hack to get the behaviour at least? |
I took me some time to get to this solution. Simply use |
I believe what you actually need now is below. showAction requires an array in PropTypes validation
|
Still does not work for me like this:
|
My workaround for a function MySelect(props) {
const wrapperRef = React.useRef<any>(null);
// Workaround to avoid having the main select container get focus.
// When we pass tabIndex it's currently being set on the container
// and the internal input but we want to have only the input get
// the focus so we remove the container's tabIndex attribute.
if (wrapperRef.current && wrapperRef.current.firstChild) {
wrapperRef.current.firstChild.removeAttribute('tabIndex');
}
return (
<div ref={wrapperRef}>
<Select
showSearch
{...props}
/>
</div>
);
} |
Version
2.13.10
Environment
browser version
Reproduction link
https://codepen.io/anon/pen/GOxqow
Steps to reproduce
Click on the first field, then press tab and try to type something.
What is expected?
When tabbing the focus should change to the Select and let you type so you can search between options.
What is actually happening?
When tabbing you are not able to type.
The text was updated successfully, but these errors were encountered: