Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome autofill should set the form to valid

On the first image, you see a bug, where Chrome does not set the form to valid when autofilling.

enter image description here

This is how it should look like.

enter image description here

I found a Github Issue to my issue here, but it is based on Angular. I'm working with Vue.

The label goes only up when the field is focues or valid.

input:focus ~ label, input:valid ~ label        {
  top:-20px;
  font-size:14px;
  color:#5264AE;
}

Besides that, the html with shadow nodes looks like this:

<input type="email" name="email" autocomplete="username" data-vv-delay="500" aria-label="Your email" required="required" class="" aria-required="true" aria-invalid="false">
   <div pseudo="-internal-input-suggested" id="placeholder" style="display: block !important;">[email protected]</div>
</input>

What could I do?

like image 955
Philipp Mochine Avatar asked Dec 06 '25 06:12

Philipp Mochine


1 Answers

Ok I found one solution over here.

In my case it's (input:-webkit-autofil):

input:focus ~ label, input:valid ~ label, input:-webkit-autofill ~ label{
  top:-20px;
  font-size:14px;
  color:#5264AE;
}
like image 133
Philipp Mochine Avatar answered Dec 08 '25 18:12

Philipp Mochine