Form novalidate vs. custom validity on number inputs with non‑multiple steps
0 reputation · 17 Jan 2021, 06:39 UTC
Form novalidate vs. custom validity on number inputs with non‑multiple steps
When a form carries the novalidate attribute, browsers suppress native constraint checks but still allow JavaScript to apply custom validity messages via setCustomValidity. Recent tests show Safari silently clears these messages on submission, Chrome and Edge flag a typeMismatch for values that are not exact multiples of the declared step, and Firefox accepts the value unless it lies outside min/max. The timing of setCustomValidity after the submit event also differs: Chrome applies the message immediately, whereas Safari defers until the next validation cycle. These inconsistencies raise questions about the intended cross‑browser contract for custom validation on input type="number" when novalidate is present.
- Why does Safari discard custom validity messages on a form marked
novalidateupon submission? - What is the expected behavior for
typeMismatchon non‑multiple step values whennovalidateis used? - Should
setCustomValidityinvoked after thesubmitevent be applied synchronously across browsers?