Sub topic 5
Field order: matching the user's mental model
This chapter assumes you can write basic HTML forms and CSS layouts, and that you know what a label is from the earlier chapters. No JavaScript is needed here.
Order by the user's task, not your database
Developers often list fields in the order the database stores them. Users think in a different order. They ask who they are, how to reach them, where something goes, and how they will pay. Order the fields to follow that sequence.
Three rules cover most cases:
- Start with the easiest, most familiar questions, such as name and email. Early progress encourages people to keep going.
- Keep related questions next to each other. Ask for street, city, and postcode as one block, not scattered across the form.
- Put sensitive or effortful questions last, after the user has invested some effort. Examples are payment details and long free-text answers.
Use a single column
A single column gives one reading path: top to bottom. Multi-column layouts make people guess whether to read across or down, and they often skip a field. Place fields side by side only when they are short and clearly one unit, such as day, month, and year, or city and postcode.
Keep the DOM order the same as the visual order
Keyboard users move through fields in source order, and screen readers read in source order. If CSS shows the fields in a different order, focus jumps around the screen.
.checkout {
display: flex;
flex-direction: column;
}
/* Moves this field to the top visually, but Tab still reaches it last. */
.checkout .promo-code {
order: -1;
}The order property, grid placement, and position: absolute all change only what the user sees. Fix the HTML order instead of reordering with CSS. Avoid positive tabindex values for the same reason: they override the natural order and are hard to maintain.
<form action="/checkout" method="post">
<label for="name">Full name</label>
<input id="name" name="name" type="text" autocomplete="name" required>
<label for="email">Email address</label>
<input id="email" name="email" type="email" autocomplete="email" required>
<label for="street">Street address</label>
<input id="street" name="street" type="text" autocomplete="address-line1" required>
<label for="city">Town or city</label>
<input id="city" name="city" type="text" autocomplete="address-level2" required>
<label for="postcode">Postcode</label>
<input id="postcode" name="postcode" type="text" autocomplete="postal-code" required>
<button type="submit">Continue to payment</button>
</form>This form moves from identity to contact to location. It matches the order in which people say these things aloud, and autofill can complete it in one pass.
Handle conditional fields carefully
Some fields apply only after an earlier answer, such as "Other, please specify" after a choice. Place the follow-up field directly after the field that triggers it, so the new field appears where the user is already looking. Inserting it earlier in the page pushes content down and loses their place.
Common mistakes
| Mistake | Effect | Fix |
|---|---|---|
| Asking for payment before contact details | Users abandon at the hardest step first | Move easy fields to the top |
| Splitting address fields with unrelated questions | Users lose the thread | Keep each topic together |
| Reordering visually with CSS `order` | Focus jumps unpredictably | Change the HTML order |
| Two-column layout of unrelated fields | Fields get skipped | Use one column |
The next chapter covers grouping related fields with fieldset and legend, which makes the structure you built here explicit to assistive technology.
Exercise
A designer uses CSS grid to show a "Postcode" field above a "Street address" field, but the HTML lists street address first. What problem does this cause, and how do you fix it?
Show answer
Keyboard and screen reader users follow the HTML order, so they reach "Street address" first while the screen shows "Postcode" first, and focus appears to jump. Fix it by reordering the HTML so the source order matches the intended visual order, and remove the grid placement that overrides it.