forms
Installation
SKILL.md
If .ux-profile.md exists at the project root, read it before changing surfaces, forms, or focus behavior.
If this form is a dedicated page (auth, wizard, or long edit), name Pattern 3 — Form via page-patterns before writing the page.
Intent
Forms punish users when errors appear too early, linger too long, or block submission with a dead button. Validation should reward correction, reduce field count, and never trap the user behind a disabled submit control.
Hard Rules (Non-Negotiable)
- Never mark invalid while typing in a pristine field. No red borders, error text, or
aria-invalid="true"until the field has been blurred at least once without a valid value. - Trigger validation on initial blur. First leave-event runs full field rules; empty required fields error on blur, not on first keystroke.
- Once invalid, clear error immediately on focus or first corrective keystroke. Do not wait for re-blur to remove error styling after the user engages with the field.
- Eliminate redundant fields. Infer city/state from postal code; use single Full Name unless legally required to split; merge related optional fields into one where possible.
- Disabled submit buttons are prohibited. Keep submit clickable at all times; on click with incomplete/invalid data, scroll to first error and show inline messages — never a silent no-op.
See reference/form-best-practices.md for keyboard submit, autocomplete attributes, input masking, and field reduction patterns.