Input elements should have autocomplete attributes

From Chromium Projects' Design Documents:

Autocomplete attributes help password managers to infer the purpose of a field in a form, saving them from accidentally saving or autofilling the wrong data.

You can use the autocomplete attribute on an HTML element that needs to be managed by a password manager for automatically filling its value. The value of autocomplete attribute depends on the field about which you want to convey more information to the password manager. Consider the following examples:

  1. Current password field - autocomplete="current-password"
  2. New password field - autocomplete="new-password"
  3. Credit card field - autocomplete="cc-number"

Try changing

<input type="password" name="password">

to

<input type="password" name="password" autocomplete="on">

Autocomplete lets web developers specify what (if any) permission the user agent has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field.

It's pretty powerful.


Turning off Autocomplete

You have the below options for working with errors of the below format Input elements should have autocomplete attributes thrown by the console by modifying:

<input type="password" name="password">
  1. Set the autocomplete attribute to off at the <form> or <input> which:
    • Enforces browser to NOT store any data
    • Disables caching form data in the session history
<input type="password" name="password" autocomplete="off">
  1. Another way to prevent autofilling by the browser is:
    The below suggestions are browser specific
<input type="password" name="password" autocomplete="new-password"> <!-- For Mozilla-->
<!-- or -->
<input type="password" name="password" autocomplete="current-password"> <!-- For Chrome-->