How do you tell if a browser has auto filled a text-box? Especially with username & password boxes that autofill around page load.
My first question is when does
From the MDN docs for the :-webkit-autofill CSS pseudo-class:
The :-webkit-autofill CSS pseudo-class matches when an element has its value autofilled by the browser
We can define a void transition css rule on the desired element once it is
:-webkit-autofill
ed. JS will then be able to hook onto the animationstart
event.
Credits to the Klarna UI team. See their nice implementation here: