:user-valid and :user-invalid
Validity pseudo-classes that wait for the user. They match like :valid and :invalid, but only once the field has been altered, so a pristine required field stays quiet. A submit attempt counts as interaction too.
Delete: the script that listens for blur and input events just to add a “touched” class, so error styles don’t fire before the user has typed anything.
/* a script marks fields the user has visited */
input.touched:invalid { border-color: firebrick; }
/* the browser tracks interaction itself */
input:user-invalid { border-color: firebrick; }The core suite passes in every current stable run. One edge is unsettled: when these flip mid-edit inside multi-part fields like date inputs is covered only by a test still marked tentative, and Chrome is currently the only engine passing it. If your validation styling leans on the exact timing inside date or time inputs, keep the class for those. In a browser too old to have these, the rule never matches: no inline highlighting, not a broken form.