I see in the standard that I can have autocomplete
either equal to username
or email
on an input field.
In my case, username is actually the user's email.
What is the best autocomplete
to use on my username input
field in this case to maximize compatibility with password managers?
The autocomplete attribute specifies whether a form or an input field should have autocomplete on or off. Autocomplete allows the browser to predict the value. When a user starts to type in a field, the browser should display options to fill in the field, based on earlier typed values.
If you are defining a user management page where a user can specify a new password for another person, and therefore you want to prevent autofilling of password fields, you can use autocomplete="new-password" .
The autocomplete attribute specifies whether a form should have autocomplete on or off. When autocomplete is on, the browser automatically complete values based on values that the user has entered before. Tip: It is possible to have autocomplete "on" for the form, and "off" for specific input fields, or vice versa.
For a login form I think it's better to use autocomplete="username"
for a username field, even if it is expected to be an email address.
I have no hard evidence for this but I expect this would be more friendly to password managers.
This article suggests the same.
A design document from Chromium aimed at developers also seems to suggest the same, and I quote from that:
<form id="login" action="login.php" method="post"> <input id="emailfield" type="text" value="[email protected]" autocomplete="username"> <input type="password" autocomplete="current-password"> <input type="submit" value="Sign In!"> </form>
For a registration form, autocomplete="email"
may make more sense.
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