material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

How to avoid autofill in TextField Component?

Open AleffHenrique opened this issue 10 years ago • 3 comments

I tried all possible sollutions discussed on this question on StackOverflow. Nothing worked. Any idea how could I avoid this browsers' behavior?

AleffHenrique avatar Jan 11 '16 22:01 AleffHenrique

I think most browsers use the name of input to figure out whether it should provide suggestions or not. If you just pass is unique generate name to the input, it should prevent autofill from occurring.

newoga avatar Jan 11 '16 22:01 newoga

@newoga Thanks, It works fine right now. But when a form has multiple TextFields with unique names the autofill isn't disabled. Should be it expected?

AleffHenrique avatar Jan 11 '16 23:01 AleffHenrique

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

BenAhlander avatar May 20 '19 16:05 BenAhlander