Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 4.8 — Form UX and Autofill
HTML · Example 1 of 2

Autofill tokens, keyboards and Enter keys

Open this page on a phone to see each keyboard. The 16px font size stops iPhones from zooming in when a field is focused.

Good forms ask for little, label everything, let the browser autofill with autocomplete tokens, show the right phone keyboard with inputmode and enterkeyhint, and explain errors next to the field in words a person can act on.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 5 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write a delivery address form (name, street address, city, PIN code, phone) with the right autocomplete tokens and keyboards.

02

Write a password field for a sign-up form with a visible rule hint linked by aria-describedby and the token that lets browsers suggest a strong password.

Explain it without notes

01

What does the autocomplete attribute do, and why does using the right token matter?

02

What's the difference between type, inputmode and enterkeyhint?

03

Describe how to show an accessible error message for one field.

04

Give five ways to make a form easier to fill in.

Autofill tokens, keyboards and Enter keys

Preview

Press Run to see the page.

Console

Nothing logged yet.

Expected console output

name | autocomplete: name | keyboard: (from type) | enter: (default)
email | autocomplete: email | keyboard: (from type) | enter: (default)
pw | autocomplete: new-password | keyboard: (from type) | enter: (default)
otp | autocomplete: one-time-code | keyboard: numeric | enter: done
zip | autocomplete: postal-code | keyboard: numeric | enter: next
q | autocomplete: (none) | keyboard: (from type) | enter: search