The batik class sign-up sheet as a real form: type, Kirim and Reset, then the browser answers when :invalid, :user-invalid and :user-valid match, and Rara is…
Why it matters
A form that is red before anyone fills it in makes people hesitate and leave. Getting the timing right used to need a "touched" state in JavaScript (Formik, React Hook Form). Now the browser keeps the "touched" mark itself, and the rules still come from the HTML (required, type, minlength, pattern).
The key idea
The same validity rules, only the moment differs
Common mistakes
Styling :invalid on required fields An empty required field is invalid from the moment the page opens, so the form is red before anyone fills it in. Use :user-invalid for the error colour and message.
Thinking :user-invalid is the same as :invalid The validity logic is the same (from the HTML). The difference is when: :user-invalid waits until the field is changed and left, or the form is submitted. After that they do look the same.
Still tracking "touched" in JS For the look, not any more: the browser keeps the mark, requestSubmit() turns it on, reset() turns it off. JS is only needed for complex messages (say, a check against the server).
Try it in this playground
Type abc in Email, but do not leave yet:invalid matches already, :user-invalid does not: you have not left the field.
Now leave the field (Tab or click outside) The log shows it: change then blur, and :user-invalid goes false → true.
Fix it into a valid email The red goes on each keystroke, no blur needed: :user-valid matches.
Reset, then Kirim without typing The empty required fields turn red at once: a submit attempt marks them all as touched.