[TextField/Menu] Menu auto focus causes TextField to lose focus
See original GitHub issueProblem description
With a controlled TextField, the field loses focus when re-rendered in the precense of a Menu component elsewhere that does not have disableAutoFocus set to true. Even if the menu is not open, and has not been interacted with.
Steps to reproduce
- Add a controlled
TextFieldto your app - Add a
Menuwith nodisableAutoFocusprop (this will default the prop to false) - Click in the
TextFieldsuch that it takes focus, note that the underline appears - Enter a single character
- Observe that the
TextFieldloses focus on re-render - Change the
Menuso thatdisableAutoFocusis set totrue - Enter a single character in the
TextField - Observe that the
TextFieldno longer loses focus
Versions
- Material-UI: 0.15.0
- React: 15.0.2
- Browser: Chrome 51.0.2704.63 (64-bit)
Issue Analytics
- State:
- Created 7 years ago
- Reactions:42
- Comments:8 (1 by maintainers)
Top Results From Across the Web
In React ES6, why does the input field lose focus after typing a ...
This will cause the input to lose focus. If the elements are generated within a .map() function, use the index to be part...
Read more >React Text Input Losing Focus After Each Keypress
React Text Input Losing Focus After Each Keypress. This bug took me a while to figure out, so I thought I would share...
Read more >Focus and text fields - Flutter documentation
Focus a text field as soon as it's visible To give focus to a text field as soon as it's visible, use the...
Read more >focused(_:) | Apple Developer Documentation
The text field binds its focus state to the Boolean value usernameFieldIsFocused . A “Submit” button's action verifies whether the name is available....
Read more >focus - Cypress Documentation
Focus, type, and blur a textarea. // yields the <textarea> for further chaining cy. · Focus is not an action command . ·...
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 Free
Top 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
For those, who has no luck with previous suggestions - try this one
Finally !!! After spending hours on trying to debugging this and going all over the place in redux-forms this finally came to this which fixed the exact same issue for me too !