admin管理员组文章数量:1026989
Is it possible to initially set focus to an input field of an Dropdown element?
<Dropdown
name={name}
placeholder='Select type'
search
searchInput={{ type: 'text' }}
selection
onChange={this.handleChange}
options={options}
/>
So the user should be able to start typing/searching without the need of clicking on the dropdown input field...
Is it possible to initially set focus to an input field of an Dropdown element?
<Dropdown
name={name}
placeholder='Select type'
search
searchInput={{ type: 'text' }}
selection
onChange={this.handleChange}
options={options}
/>
So the user should be able to start typing/searching without the need of clicking on the dropdown input field...
Share Improve this question edited Sep 23, 2017 at 20:58 Oleksandr Fediashov 4,3351 gold badge25 silver badges43 bronze badges asked Sep 23, 2017 at 11:03 user3142695user3142695 17.4k55 gold badges200 silver badges375 bronze badges 01 Answer
Reset to default 3If I understand your question correctly, you want to give your Dropdown ponent focus when your content is loaded?
If that is indeed the case, then you want to make use of Refs. See the following for a detailed example: Refs and the DOM
In particular:
When to Use Refs
There are a few good use cases for refs:
- Managing focus, text selection, or media playback.
- Triggering imperative animations.
- Integrating with third-party DOM libraries.
Is it possible to initially set focus to an input field of an Dropdown element?
<Dropdown
name={name}
placeholder='Select type'
search
searchInput={{ type: 'text' }}
selection
onChange={this.handleChange}
options={options}
/>
So the user should be able to start typing/searching without the need of clicking on the dropdown input field...
Is it possible to initially set focus to an input field of an Dropdown element?
<Dropdown
name={name}
placeholder='Select type'
search
searchInput={{ type: 'text' }}
selection
onChange={this.handleChange}
options={options}
/>
So the user should be able to start typing/searching without the need of clicking on the dropdown input field...
Share Improve this question edited Sep 23, 2017 at 20:58 Oleksandr Fediashov 4,3351 gold badge25 silver badges43 bronze badges asked Sep 23, 2017 at 11:03 user3142695user3142695 17.4k55 gold badges200 silver badges375 bronze badges 01 Answer
Reset to default 3If I understand your question correctly, you want to give your Dropdown ponent focus when your content is loaded?
If that is indeed the case, then you want to make use of Refs. See the following for a detailed example: Refs and the DOM
In particular:
When to Use Refs
There are a few good use cases for refs:
- Managing focus, text selection, or media playback.
- Triggering imperative animations.
- Integrating with third-party DOM libraries.
本文标签: javascriptReact semantic UI How to set focus for input field of dropdown elementStack Overflow
版权声明:本文标题:javascript - React semantic UI: How to set focus for input field of dropdown element - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745612569a2159092.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论