Chrome warning “[DOM] Password forms should have (optionally hidden) username fields for accessibility” in console even with hidden username field

I had the same problem. After some digging, I found that it needs to be an input element with the type text. By “optionally hidden” they mean that you may hide it with CSS.

If you just add an input with the name email or username chrome gives you another warning saying that input elements should have autocomplete attributes. So this is what I came up with to fix these errors:

<input
  type="text"
  name="email"
  value="..."
  autocomplete="username email"
  style="display: none;"
>

You will need to manually render the actual username or email into the elements value attribute.

Also, keep in mind that inline styles are not a very good practice.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)