Add `.focus` `.blur` method for every form control components
See original GitHub issueMake sure that every form control component has.focus
method, see: https://facebook.github.io/draft-js/docs/advanced-topics-managing-focus.html
- auto-complete
- cascader
- checkbox
- date-picker
- input https://github.com/ant-design/ant-design/commit/d94f0ab09a5dd66a1dbb7b4504b14a9a58fa2a55#diff-26cb6da96d10397e18e7dbd6c5d8f7a1R141
- input-number https://github.com/ant-design/ant-design/pull/7615
- mention
- radio
- rate
- select
- slider
- switch
- time-picker https://github.com/ant-design/ant-design/commit/760a5ffc90ddd7718d2ada1b2cd19cba839dc40a
- tree-select <del>* [ ] upload</del>
Issue Analytics
- State:
- Created 7 years ago
- Reactions:23
- Comments:15 (4 by maintainers)
Top Results From Across the Web
Focusing: focus/blur - The Modern JavaScript Tutorial
An element receives the focus when the user either clicks on it or uses the Tab key on the keyboard. There's also an...
Read more >Angular FormControl focus and blur Event - ConcretePage.com
On this page we will provide focus and blur events example with Angular FormControl. The focus and blur events are opposite to each...
Read more >Focusing: focus/blur | W3docs JavaScript Tutorial
Learn the basics of focusing in this chapter. Here we cover what focus and blur are, their functions, as well as how to...
Read more >HTMLElement.blur() - Web APIs - MDN Web Docs
The HTMLElement.blur() method removes keyboard focus from the current element. Syntax. blur()
Read more >Add `.focus` `.blur` method for every form control components
Add `.focus` `.blur` method for every form control components · [x] auto-complete · [x] cascader · [x] checkbox · [x] date-picker · [x]...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ChuckJonas That’s exactly the problem. Most of you probably want to really focus and open the rc-select component beneath the antd select component. Try this:
You can also directly use setState on it to have full control over it. Doing it this way won’t close the select on blur:
This is still an ugly workaround though.
EDIT: I know that you can do the same also with plain javascript and document.getElementById, but why use React when you directly manipulate the dom anyway? This is just another way of accomplishing the focus, but in a more react-compatible manner. Doing it with document.getElementById probably has complex consequences which are just not worth it.
calling .focus() on a Select ref still does not work.