liveBook · Manning

Native HTML validation

As explained in Architecting Accessibility

Native HTML validation is browser-provided form validation based on constraints declared through HTML attributes.

Native HTML validation uses attributes such as required, type, and pattern to check form fields in the browser. It can block invalid submissions, display messages, and typically focus the first invalid field. Clear correction guidance can reduce confusion and frustration, especially for people unfamiliar with a form or its requirements. section 6.1.6

Native validation may need support when:

  • Browser messages do not give enough guidance for a complex field. section 6.1.6
  • A longer form reports one invalid field at a time, making recovery repetitive. section 6.1.6
  • More specific messages are needed; JavaScript’s Constraint Validation API can customize them while retaining native constraints. section 6.1.6

How Architecting Accessibility covers it

How deep it goes
Explains required, type, and pattern constraints, browser behavior, limitations, and JavaScript customization.
Examples
Uses required, type, and pattern attributes and an email-format correction message as examples.
What you can do after
Apply it via HTML constraint attributes to block invalid submissions, then customize guidance with setCustomValidity() when needed.
How it connects
Links HTML constraint attributes with form validation and JavaScript’s Constraint Validation API.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Architecting Accessibility. The section links point to the parts of the book it draws on.