Sub topic 5
Field order: matching the user's mental model
What this chapter assumes
You know basic HTML form elements and CSS spacing. You have read the chapters on labels and label placement, so each field here already has a visible, associated label. This chapter covers the order of the fields and the flow of the page. Grouping with fieldset and legend has its own chapter, so it appears here only as a decision point.
Why order matters
Users do not read a form as a list of inputs. They read it as a conversation. Each question is a turn, and the next question should feel like a natural follow-up to the last one. When the order matches what the user expects, they move quickly and make fewer mistakes. When it does not, they stop, scan back up the page, and sometimes leave.
The user's mental model is their expectation of what information is needed and in what sequence. You usually learn it from three sources:
- Real-world equivalents, such as a paper form, a shop counter, or a phone call.
- Conventions from other sites, such as name before address and address before payment.
- The task itself. Someone booking a flight thinks "where, when, who", not "who, when, where".
Your internal data model is a poor guide. A database may store created_at first and last_name third, but users never think in those terms.
Principle 1: a single column
For most forms, use one column of fields. A single column gives the eye one path: down. Multi-column layouts create ambiguity. A user may read across a row, or down the left column and then the right one. Screen magnifier users and people on narrow screens may see only one column at a time and miss the other.
There are reasonable exceptions. Short fields that form a single unit can share a row. Examples are day, month and year, or city and postcode. The test is whether the user thinks of them as one answer.
The DOM order must match the visual order. If you use CSS Grid or Flexbox to move fields around, the keyboard Tab order still follows the source order. Keyboard and screen reader users then jump around the page unpredictably.
<form>
<div>
<label for="given-name">First name</label>
<input id="given-name" name="given-name" type="text" autocomplete="given-name">
</div>
<div>
<label for="family-name">Last name</label>
<input id="family-name" name="family-name" type="text" autocomplete="family-name">
</div>
<div>
<label for="email">Email address</label>
<input id="email" name="email" type="email" autocomplete="email">
</div>
<button type="submit">Create account</button>
</form>form {
max-width: 28rem;
display: flex;
flex-direction: column;
gap: 1.25rem;
}
/* Do not use `order`, `flex-direction: column-reverse`, or
grid placement to reorder fields visually. Change the HTML instead. */Principle 2: easy before hard, and general before specific
Start with questions that are easy to answer and obviously relevant. Ask for the effortful or sensitive items later, after the user has made some progress and has more reason to continue. A sign-up form that opens with a phone number request feels invasive. One that opens with an email address does not.
Put fields in the order a person would naturally give them:
- Who you are: name, then contact details.
- Where: address, from the broadest unit to the narrowest or the reverse, following the convention of the user's country.
- What you want: the specific choices and options.
- How you will pay or confirm.
Address order is a good example of local convention. A US address runs street, city, state, ZIP code. A UK address runs street, town, postcode. A Japanese address runs from the largest unit to the smallest. If your audience spans countries, use autocomplete tokens such as street-address, address-level2 and postal-code, and let the browser fill the fields.
Principle 3: group related questions
Fields that answer one larger question should sit together and be visibly separate from the next topic. Billing details belong together, and so do delivery details. Use spacing and headings for sections. Use fieldset and legend when a set of controls needs a shared question, as with radio buttons or a date split into three inputs. The grouping chapter covers the markup.
Proximity does the visual work. A common rule is to put less space between a label and its own input than between one field and the next. That way each label clearly belongs to the input below it.
.field label {
display: block;
margin-block-end: 0.25rem; /* small gap: label belongs to its input */
}
.field + .field {
margin-block-start: 1.25rem; /* larger gap: a new question starts */
}
.section + .section {
margin-block-start: 2.5rem; /* largest gap: a new topic starts */
}Principle 4: ask only what you need
Every field costs effort and gives the user a reason to abandon the form. Before you order the fields, reduce them. Ask of each one:
- Will we use this answer for something the user cares about?
- Can we work it out ourselves? A card number gives the card type. A postcode lookup gives the city.
- Can it wait until after sign-up?
- Does it need to be asked twice? A "confirm email" field is a common example. It adds typing, and users often paste the first value into the second, so the check does not catch much.
Reducing fields shortens the form and often removes the hardest ordering decisions.
Principle 5: conditional questions follow their trigger
When a question only applies after an earlier answer, place it directly after the answer that triggers it. Do not ask "Other (please specify)" in a separate section. Reveal the follow-up beside its trigger.
When you reveal a field, follow these rules:
- Insert the new field immediately after the control that triggers it in the DOM, so keyboard and screen reader users meet it next.
- Do not move focus automatically. Let the user continue in their own order.
- Hide the field with the
hiddenattribute when it does not apply. Hidden fields leave the accessibility tree and are skipped by Tab. - Do not submit stale values from a hidden field the user filled in and then dismissed. Clear them, or ignore them on the server.
<fieldset>
<legend>How did you hear about us?</legend>
<div>
<input type="radio" id="src-search" name="source" value="search">
<label for="src-search">Search engine</label>
</div>
<div>
<input type="radio" id="src-friend" name="source" value="friend">
<label for="src-friend">A friend</label>
</div>
<div>
<input type="radio" id="src-other" name="source" value="other"
aria-controls="src-other-detail">
<label for="src-other">Something else</label>
</div>
<div id="src-other-detail" hidden>
<label for="src-other-text">Tell us how</label>
<input type="text" id="src-other-text" name="source-other">
</div>
</fieldset>const detail = document.getElementById('src-other-detail');
const detailInput = document.getElementById('src-other-text');
document.querySelectorAll('input[name="source"]').forEach((radio) => {
radio.addEventListener('change', () => {
const isOther = radio.value === 'other' && radio.checked;
detail.hidden = !isOther;
if (!isOther) {
detailInput.value = '';
}
});
});Principle 6: split long forms with care
A long form with many sections may work better as several steps. Multi-step flows reduce the amount of visible work at one time, but they add costs: a progress indicator, a way to go back, and a place to save partial answers.
Use steps when:
- The sections are clearly different tasks, such as account, delivery, and payment.
- Later steps depend on earlier answers.
- The user may need to leave and return.
Keep a single page when the form has fewer than about ten fields or when users want to review everything at once. Whichever you choose, the same order rules apply inside each step.
Each step needs a clear heading. When a new step loads, move focus to that heading so screen reader users know the page changed. Show the step count in text, such as "Step 2 of 3: Delivery", not only as a graphic.
Common errors
| Error | Why it hurts | Fix |
|---|---|---|
| Fields ordered by database schema | Users meet questions in an order that does not match the task | Order by the user's task and expectations |
| Visual reordering with CSS only | Tab order and reading order no longer match the screen | Change the HTML source order |
| Two-column layout of unrelated fields | Users skip fields or read in the wrong order | Use one column, and pair only fields that form a single answer |
| Asking for sensitive data first | Users abandon before they see any value | Ask easy, relevant questions first |
| Conditional field far from its trigger | Users do not notice the new field, or lose context | Place it directly after the trigger |
| Hidden fields still submitted | The server receives stale data | Clear values or ignore hidden fields on the server |
| Splitting a short form into steps | Adds clicks and no benefit | Keep short forms on one page |
| "Confirm" duplicate fields | Doubles typing and often defeats its own purpose | Validate once and let users correct errors |
Putting it together
Here is a short checkout contact section that applies these principles: one column, easy questions first, address in local order, and autocomplete tokens so the browser can fill it.
<form action="/checkout" method="post">
<h2>Contact details</h2>
<div class="field">
<label for="c-email">Email address</label>
<input id="c-email" name="email" type="email" autocomplete="email">
</div>
<div class="field">
<label for="c-name">Full name</label>
<input id="c-name" name="name" type="text" autocomplete="name">
</div>
<h2>Delivery address</h2>
<div class="field">
<label for="c-street">Street address</label>
<input id="c-street" name="street" type="text" autocomplete="street-address">
</div>
<div class="field">
<label for="c-city">Town or city</label>
<input id="c-city" name="city" type="text" autocomplete="address-level2">
</div>
<div class="field">
<label for="c-postcode">Postcode</label>
<input id="c-postcode" name="postcode" type="text" autocomplete="postal-code">
</div>
<button type="submit">Continue to payment</button>
</form>Checking your order
Test the order in three ways:
- Tab through the form with the mouse put away. Focus should move down the screen in the same order you read it.
- Read the labels aloud in sequence. Does it sound like a sensible conversation?
- Watch someone fill it in. Hesitation, scanning back up, and skipped fields point to an order problem.
The final chapter covers testing in more detail.
Exercise
A designer uses CSS Grid to place the "Postcode" field visually above the "Street address" field, while the HTML lists street first and postcode second. What problem does this create for keyboard users, and how do you fix it?
Show answer
Tab order follows the HTML source, not the visual layout. A keyboard user would tab from the field shown second to the field shown first, so focus jumps against the reading order and the form feels broken. Fix it by reordering the HTML so postcode comes first, or, better, by questioning the design and keeping street address before postcode with the HTML and layout in agreement.
Exercise
A sign-up form asks for phone number, date of birth, and a "Confirm email" field before the user has entered anything else, and shows them in two columns. List three changes that follow from this chapter.
Show answer
Any three of these: use a single column; move easy, relevant questions such as email to the top; remove or defer the phone number and date of birth if they are not needed now; remove the "Confirm email" field; keep the HTML order the same as the visual order; add autocomplete tokens so the browser fills fields.