Sub topic 2
Constraints and natural mapping
This chapter assumes you know basic HTML and CSS, and that you can read a simple JavaScript event handler. A constraint limits which actions a user can take, so the right action is easier to find. Natural mapping places a control so its position or direction matches the result it produces.
Constraints and natural mapping
Constraints fall into physical, logical, and semantic types. A physical constraint blocks an impossible move, such as a USB plug that fits only one way. A logical constraint follows a rule, such as a "Next" button that stays disabled until a form is valid. Semantic constraints rely on meaning, such as a trash icon that implies deletion.
Natural mapping arranges controls so the layout matches the effect. Place "Next" at the end of a form, and place "Delete" away from "Save" so users do not click it by accident.
<form id="signup">
<input id="email" type="email" required>
<button id="next" type="submit" disabled>Next</button>
</form>
<script>
const email = document.getElementById("email");
const next = document.getElementById("next");
email.addEventListener("input", () => {
next.disabled = !email.validity.valid;
});
</script>> Note: A disabled button explains nothing. Add a hint next to it that states what is missing.
Feedback: telling users what happened
Feedback is the system's response to an action. Good feedback is immediate, informative, and proportional to the action. A pressed state, a status message, or a changed label each confirm that the system received the input.
The following button disables itself during a save and announces the outcome in a live region, which screen readers read aloud.
<button id="save" type="button">Save</button>
<p id="status" role="status"></p>
<script>
const button = document.getElementById("save");
const status = document.getElementById("status");
button.addEventListener("click", async () => {
button.disabled = true;
status.textContent = "Saving…";
try {
const response = await fetch("/api/save", { method: "POST" });
if (!response.ok) throw new Error("HTTP " + response.status);
status.textContent = "Saved.";
} catch (error) {
status.textContent = "Could not save. Check your connection and try again.";
} finally {
button.disabled = false;
}
});
</script>Timing: response-time thresholds and progress indication
Response-time guidance, traced to Miller (1968) and Card, Robertson, and Mackinlay (1991), sets three thresholds. Under 0.1 second feels instant. Under 1 second keeps the user's train of thought. Beyond about 10 seconds, users lose focus and need progress feedback.
| Response time | User perception | Suitable feedback |
|---|---|---|
| Under 0.1 s | Instant | None needed |
| 0.1 to 1 s | Noticeable pause | Pressed or pending state |
| 1 to 10 s | Waiting | Spinner or pending message |
| Over 10 s | Attention drifts | Progress bar with estimate and cancel option |
Exercise
A report export takes about 25 seconds. Which feedback should the interface show?
Show answer
Show a progress indicator with an estimate or percentage, plus a cancel option. Beyond about 10 seconds, a spinner alone leaves users unsure whether the system is still working.