Skip to content

Commit dbd44fc

Browse files
committed
Fix: Cases where the input is flagged as interacted by the browser, but we don't detect it
1 parent 743b502 commit dbd44fc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

validation-output.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ class ValidationOutput extends HTMLElement {
9292
}
9393

9494
#handleInput = () => {
95+
// The form could be tried to be submitted but failed on other inputs.
96+
// In this case, our #for target is flagged as "interacted" and gets the :user-invalid state.
97+
if (this.#for.matches(":user-invalid")) {
98+
this.#interacted = true;
99+
}
100+
95101
// User did not interact yet with the input element; this means that :user-invalid state is not applied yet.
96102
if (!this.#interacted) {
97103
return;

0 commit comments

Comments
 (0)