HTML
html/input-type
An input for an email address, phone number or URL uses type email, tel or url, not text.
minorstaticfe-forms
Why
A plain text field gives a phone the letter keyboard for a phone number, no @ key for an email, and no built-in check of the format. The right type costs nothing and makes the field faster and less error-prone to fill.
Fix
Use type="email", type="tel" or type="url" and keep the matching autocomplete token. For digits that are not quantities (codes, card numbers) use type="text" with inputmode="numeric" (see html/no-number-for-codes).
Examples
<!-- bad -->
<input id="email" name="email">
<!-- good -->
<input id="email" name="email" type="email" autocomplete="email">Sources
Facts
- Id
html/input-type- Severity
- minor
- Check
- static checked in the source by
audit - Applies to
htmlangularvuesvelteastrojsx- Taught by the skill
fe-formsNative forms and validation- Since version
- 0.1.0
Read it in the terminal
npx github:dawidolko/frontend-skills explain html/input-type