[TextField] autoFocus doesn't seem to be working
See original GitHub issueProblem description
I tried making auto focus on my TextField with no success.
I also looked and saw that the autoFocus is being @ignore from the docs. Why is that?
Tried with autoFocus={true}
<TextField
autoFocus={true}
onChange={ (e) => debounceOnChange(e.target.value) }
type="search"
/>
Tried with inputProps={true}
<TextField
inputProps={autofocus: {true}}
onChange={ (e) => debounceOnChange(e.target.value) }
type="search"
/>
And even InputProps:
<TextField
InputProps={autofocus: {true}}
onChange={ (e) => debounceOnChange(e.target.value) }
type="search"
/>
Versions
- Material-UI: 1.0.0-alpha-19
- React: 15.6.1
- Browser: Al of them
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
[TextField] autoFocus doesn't seem to be working · Issue #7247
I have noticed that the autoFocus behaviour is unreliable, I believe it's an issue with React internally. I have noticed the same thing...
Read more >Flutter throws an error when i use Text field with auto focus
Because with auto focus, the keyboard show up first but textfield is still not exist ... Rebuild your project, and it should work....
Read more >Mui TextField doesn't autofocus : r/reactjs - Reddit
If you are manually setting focus to input it has nothing to do with autofocus attribute. Autofocus is used to tell that input...
Read more >SwiftUI default focus on TextField… | Apple Developer Forums
This doesn't work for me. I hope they fix this bug — one of the most important use cases of focus is to...
Read more >autofocus not working in UI for ASP.NET MVC | Telerik Forums
Hi, I'm trying to set the autofocus on my edit screens. If it's an Kendo-control that I want to have autofocus, it doesn't...
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
Well it seems to work well with
inputProps={{ autoFocus: true }}see https://codesandbox.io/s/ERxnnX9mmIn case someone is struggling with this.
I updated the implementation in the codesandbox link above to use the latest version, and it works in codesandbox. https://codesandbox.io/s/recursing-framework-deoxv?fontsize=14&hidenavigation=1&theme=dark
However I’m struggling with this in my application. I verified
onChangeis not invoked immediately as well asonBlurso I don’t think it is an event issue.However I was able to get it to work using a
ref