Sub topic 6
Feedback: Telling Users What Happened
Assume you already know basic HTML and CSS, and you understand common interface controls such as buttons, forms, and menus. This chapter focuses on feedback: the information an interface gives after a person acts.
Feedback answers a user’s immediate question: “Did the system receive my action, and what happened next?” Without feedback, a person may click again, abandon the task, or form the wrong idea about the system.
The feedback loop
An interaction usually follows this sequence:
- The user chooses an action.
- The interface receives the action.
- The system changes, starts work, or rejects the action.
- The interface communicates the result.
- The user decides what to do next.
Good feedback reduces uncertainty at each step. It does not need to be decorative. A changed button label, a progress indicator, a confirmation message, or an error message can all provide useful feedback.
Immediate, informative, and proportional
Useful feedback has three properties:
- Immediate: it begins soon enough to show that the action was received.
- Informative: it tells the user what state the system is in.
- Proportional: its strength matches the importance and duration of the action.
For example, a favorite button might change color immediately. A file upload might show progress. A payment might require a clear confirmation and a receipt.
Feedback should describe the system’s state, not merely repeat the user’s action. “Clicked” is usually less useful than “Saving…” or “Saved.”
Match feedback to the operation
Different operations need different feedback patterns. Choose a pattern based on how long the operation usually takes and whether it can fail.
| Operation | Useful feedback | Main purpose |
|---|---|---|
| Instant toggle | Changed visual state | Confirm the new setting |
| Short request | Pending state, then result | Show that work is in progress |
| Long task | Progress or completion estimate | Set expectations |
| Irreversible action | Confirmation and durable result | Prevent uncertainty and mistakes |
For a short operation, a spinner may create more distraction than clarity. For a long operation, a spinner alone is insufficient because it does not show how much work remains.
A pending control should also prevent duplicate actions when repeated clicks could create duplicate records, payments, or requests. Disable the control while the request is pending, but restore it when the operation ends or fails.
Give feedback through more than appearance
Color and animation can help sighted users, but they should not carry the entire meaning. A successful action might use a changed color, a text label, and a status message. An error might use an icon, text, and focus moved to the relevant field.
Use feedback that matches the context:
- Visual feedback is useful for state changes, progress, and location.
- Auditory feedback can announce important changes, especially for screen-reader users.
- Haptic feedback can confirm actions on touch devices.
- Text feedback is often the clearest way to explain success, failure, or next steps.
Avoid excessive feedback. A sound, animation, toast, modal, and page change for one small action can overwhelm the user. Use the least disruptive signal that communicates the result.
Implement a pending and completed state
The following example gives immediate pending feedback, blocks duplicate clicks, and reports the final result in a status region. The role="status" attribute identifies text that assistive technology should announce without moving the user’s focus.
<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>The pending message matters even when the request is usually fast. Network speed varies, and users need evidence that the click worked. The finally block makes sure the button becomes usable again after both success and failure.
A disabled button alone is incomplete feedback. It shows that the control cannot currently be used, but it does not explain whether the request is progressing, finished, or blocked. Pair control states with a message when the result is not otherwise obvious.
Check feedback during an audit
For each important action, ask:
- Does the interface acknowledge the action quickly?
- Can the user tell whether work is pending, complete, or failed?
- Does the feedback explain what to do next?
- Is the feedback perceivable without relying on color, sound, or motion alone?
- Can the user retry safely after a failure?
- Does the control prevent accidental duplicate actions?
These questions expose silent operations and misleading states. They also separate feedback from decoration. A polished animation is not useful if the user still cannot tell whether the data was saved.
Exercise
A user submits a form. The button changes to gray, but no message appears. The request takes several seconds and can fail. What feedback should you add?
Show answer
Show a pending state immediately, prevent duplicate submissions, and provide a text status such as “Saving…”. After the response, show a confirmed success message or an error that explains how to recover. Do not rely on gray alone.