What should be correct autocomplete for username = email?

Viewed 3669

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?

3 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="me@example.test" 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.

Related