:user-invalid is the validation selector you actually wanted
Unlike :invalid, it waits until the user has interacted with the field — so empty required inputs stop turning red before anyone has typed anything.
Tagged
Every year we npm install something the browser already has. Six elements and one attribute that replace a library each, with the caveats that stop people finding them.
Unlike :invalid, it waits until the user has interacted with the field — so empty required inputs stop turning red before anyone has typed anything.