Sub topic 4
3. User control and freedom
This chapter assumes you have used web apps and can read short HTML and JavaScript snippets. You do not need to have studied usability before. The earlier chapters covered what heuristics are, visibility of system status, and matching the real world. This chapter covers the third heuristic, user control and freedom.
What the heuristic says
Users often choose actions by mistake. They click the wrong button, open the wrong page, or change their mind halfway through a task. Nielsen's third heuristic says that the interface should offer a clearly marked "emergency exit" so users can leave an unwanted state without a long process.
In practice, this means four things:
- Users can undo and redo actions.
- Users can cancel an operation that is in progress.
- Users can go back to where they were.
- Users can leave a flow, such as a dialog or a wizard, without losing everything.
The heuristic is about confidence. When people know a mistake is cheap to reverse, they explore more and hesitate less. When every click might be permanent, they slow down and get anxious.
How it differs from error prevention
This heuristic is easy to confuse with error prevention, which is covered in chapter 5. The two work together but act at different times.
| Heuristic | When it acts | Typical tool |
|---|---|---|
| Error prevention | Before the action | Confirmation dialog, input constraint |
| User control and freedom | After or during the action | Undo, cancel, back, close |
A confirmation dialog that says "Are you sure?" tries to stop the mistake. An undo option accepts that mistakes will happen and makes them harmless. Undo is usually the better choice for common, low-risk actions, because a confirmation dialog interrupts every user, including those who made no mistake.
Common patterns
Undo and redo
Undo reverses the last action. Redo reapplies an action that was undone. Text editors, spreadsheets and design tools treat these as basic features. Many web apps also offer a short-lived undo notice after deleting an item, such as "Message deleted. Undo".
Cancel
Long operations such as uploads, exports and searches should be cancellable. A progress indicator with no cancel control leaves users waiting for something they no longer want.
Back and navigation
The browser Back button is a user control that the interface should not break. Pages that redirect in a loop, or single-page apps that do not update the URL, trap users.
Exits from modal states
A modal is a dialog that blocks the rest of the page until it is dismissed. Every modal needs a visible close button or a Cancel button. The Escape key should also close it. Multi-step wizards need a way to go to the previous step and a way to leave entirely.
Worked example: undoing a deletion
The code below removes an item from a list and returns a function that restores it at the same position.
let items = ["Invoice", "Report", "Notes"];
function removeItem(index) {
const [removed] = items.splice(index, 1);
return function undo() {
items.splice(index, 0, removed);
};
}
const undo = removeItem(1);
// items is now ["Invoice", "Notes"]
undo();
// items is back to ["Invoice", "Report", "Notes"]Here is how it works:
items.splice(index, 1)removes one element atindexand returns it in an array.- Destructuring,
const [removed], takes that element out of the returned array. - The returned
undofunction is a closure. It remembers bothindexandremoved. - Calling
undo()runsitems.splice(index, 0, removed). This inserts the element back without deleting anything.
The user interface would show the undo function as a button in a notice, such as "Report deleted. Undo".
Limits of this simple version
The example is deliberately small. A real application needs to handle several edge cases.
- Stale undo. If the user deletes another item before pressing Undo for the first, the saved
indexmay no longer point to the right position. Real systems often keep a stack of actions and undo them in reverse order. - Time limit. An undo notice that vanishes after a few seconds is easy to miss. Choose a duration long enough to read and react to, and consider keeping the notice available for people who use assistive technology.
- Server state. If the delete already reached the server, undo must send a second request. A common alternative is to delay the real delete until the undo window closes, or to use a "soft delete" that marks the record as removed so it can be restored.
- Irreversible actions. Some actions cannot be undone, such as sending an email or charging a card. For these, fall back on error prevention: a clear confirmation, or a short delay before sending.
Diagram: the undo window
The following diagram shows the states of an item when a deletion can be undone.
The important state is PendingDelete. The item is hidden from the list, but it is not yet gone. This state is what gives the user a real way out.
Cancel during a long operation
A progress bar is covered under visibility of system status. Pairing it with a cancel button brings in user control. The markup below shows the idea.
<label for="export">Exporting report.pdf</label>
<progress id="export" value="40" max="100">40%</progress>
<button type="button">Cancel export</button>The button needs a script to do anything. The logic matters more than the markup: cancelling should stop the work, clean up partial results, and return the interface to a known state. A cancel button that only hides the progress bar, while the export continues in the background, violates the spirit of the heuristic.
Violations you will meet
These examples show how the heuristic is broken in real products.
- A checkout page has no way to go back and edit the cart, so users must abandon the order and start again.
- A cookie banner has a large Accept button, but rejecting needs several clicks through a settings page.
- A subscription can be started online in one click, but cancelling needs a phone call.
- A form wizard clears all entries when the user presses Back.
- A full-screen promotion has a tiny close icon with low contrast.
- A single-page app changes views without changing the URL, so the browser Back button leaves the whole site.
The cancellation and cookie examples are sometimes called "dark patterns", meaning designs that make the exit hard on purpose. They violate this heuristic and may also break consumer protection rules in some regions.
Fixes that work
| Problem | Design change |
|---|---|
| Delete is permanent | Offer undo for a short time, or move items to a trash that can be emptied later |
| Wizard loses data on Back | Keep entered values in state and restore them when the user returns |
| Modal has no visible exit | Add a Close button and support the Escape key |
| Upload cannot be stopped | Add a Cancel control that aborts the request |
| Cancelling needs a phone call | Provide cancellation in the same place and with similar effort as signing up |
Checking a design for this heuristic
When you evaluate an interface, ask these questions at each step of a task:
- Can I stop what I am doing without penalty?
- Can I go back one step and keep my work?
- Can I reverse the last action, and how quickly?
- Is the exit easy to see and easy to reach by keyboard?
- Is leaving as easy as entering?
Some tension is normal. Too many confirmations reduce freedom, and too much freedom can allow destructive actions. The usual resolution is to make actions cheap to reverse instead of hard to start.
Exercise
A photo app deletes a photo immediately when the user taps the trash icon. The product team proposes adding an "Are you sure?" dialog. Explain why undo may serve users better for this action, and describe one situation where a confirmation is still the right choice.
Show answer
A confirmation dialog interrupts every deletion, including the many that are intended, and users tend to click through it out of habit. An undo notice, or a "Recently deleted" folder, lets users act quickly and still recover from mistakes, which is the aim of user control and freedom. A confirmation is still the right choice when the action cannot be reversed, for example permanently emptying the "Recently deleted" folder, or sending something to other people. In those cases undo is impossible, so prevention is the only protection.
Exercise
In the JavaScript example, the list is ["Invoice", "Report", "Notes"] and the user deletes index 1, then deletes index 0, then presses Undo for the first deletion. What goes wrong, and what is one way to fix it?
Show answer
After the second deletion the list is ["Notes"]. Running the first undo inserts "Report" at index 1, which gives ["Notes", "Report"]. The original order is lost, because the saved index no longer matches the list. One fix is to keep undo actions in a stack so they run in reverse order: the second deletion is undone first, then the first. Another fix is to give each item a stable id and restore it relative to its neighbours.