I use material ui v0.20.0 and I have to prohibit saving the password for a user with TextField. I added props to TextField autocomplete='nope' cause not all the browsers understand autocomplete='off'. It seems that the last version of Chrome 63 does not accept it. Sometimes it does not work and sometimes it does. I can not get why it works so hectic. When chrome asks to save password and I save it, and after that I want to edit input I still have this :
<TextField name='userName' floatingLabelText={<FormattedMessage id='users.username' />} value={name || ''} onChange={(e, name) => this.changeUser({name})} // autoComplete='new-password' /> <TextField name='password' floatingLabelText={<FormattedMessage id='users.passwords.new' />} type='password' value={password || ''} onChange={(e, password) => this.changeUser({password})} autoComplete='new-password' />
Looks like it works in Firefox(v57.0.4)
By default TextField does not have autoComplete='off'
Add autocomplete="off" onto <form> element; Add hidden <input> with autocomplete="false" as a first children element of the form.
To turn off autocomplete on an input field in React, set the autoComplete prop to off or new-password , e.g. <input autoComplete="off" /> . When autoComplete is set to off , the browser is not permitted to automatically enter a value for the field.
The autocomplete is a normal text input enhanced by a panel of suggested options.
This seems to have worked for me (we are using material ui with redux form)
<Textfield inputProps={{ autocomplete: 'new-password', form: { autocomplete: 'off', }, }} />
"new-password" works if the input is type="password "off" works if its a regular text field wrapped in a form
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With