Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should be correct autocomplete for username = email?

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?

like image 404
Qortex Avatar asked Nov 06 '18 14:11

Qortex


People also ask

What is autocomplete in input tag?

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.

What is autocomplete new password?

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" .

What does autocomplete off mean?

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.


1 Answers

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.

like image 99
tremby Avatar answered Nov 26 '22 14:11

tremby



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!