Menu

Don't validate complex fields on every keystroke (Web HIG tip #19)
📰

Don't validate complex fields on every keystroke (Web HIG tip #19)

DEV Community: javascript·FrozonFreak·5 days ago
#3cdjh7oq
#devtojavascript#devto#dev#error#field
Long article (1321 words) — no AI summary yet.
Reading 0:00
15s threshold

Someone starts typing [email protected] into the email field on example.com/account. At the first letter the field turns red and an error appears: "Enter a valid email." They have not finished the address. Each extra keystroke flickers the same message. The check is running on every input event.

Web HIG tip #19 (Quick #53): Do not validate on every keystroke for complex fields — validate on blur or submit.

Why it matters

Email, phone, password, date and similar fields are incomplete for most of the time someone is typing. Checking them on every keystroke often means:

The first characters of a valid value look wrong, so the field starts shouting before the person has finished

Keyboard and screen-reader users can get a stream of error updates while they are still editing

A live hint, such as a character count or a password-requirement list, is not the same thing as marking the field invalid

Quick #53 is Quick-only guidance (no rule ID of its own).…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.