Sorting
Reordering a set, where the default order is the decision that matters most.
Definition
Sorting arranges results by an attribute. Because most users never change it, the default sort is one of the highest-impact defaults in any product.
Craft convention. True because the industry converged on it. Breaking it costs familiarity, not correctness.
On this plate
Reach for this when
- Presenting any ordered list or table.
- Choosing what users see first.
- A list is long enough that the order decides what most people ever see.
Common mistakes
- Default sort chosen by implementation convenience.
- Ambiguous direction indicators.
- Unstable ordering.
Getting it right
- Choose the default that answers the most common question, not the one that is cheapest to compute.
- Show the current sort explicitly, including direction.
- Make the direction indicator unambiguous. Arrow conventions vary, so pair the icon with text where space allows.
- Handle ties deterministically with a secondary key, or the order will shuffle between page loads.
- In tables, make column headers sortable and announce the sort state with aria-sort.
- Preserve sort state across pagination and navigation.
Defaults, and what each one says
The default sort is chosen once and experienced by almost everyone, which makes it one of the highest-leverage decisions on a list screen.
| Default | Suits | Risk |
|---|---|---|
| Relevance | Search results | Opaque, and easy to tune towards commercial interests |
| Newest first | Feeds, activity, support queues | Buries anything still unresolved but old |
| Alphabetical | Reference lists people scan by name | Meaningless for anything ranked |
| Price ascending | Catalogues | Reads as a recommendation of the cheapest |
| Manual order | Curated sets | Someone has to maintain it, and they will stop |
Order people can trust
Do
- Pick the default that answers the question the screen exists to answer.
- Pair the direction arrow with words, since arrow conventions genuinely differ between products.
- Add a stable secondary key so tied rows hold their position between loads.
- Keep the sort in the URL, so a shared link shows what the sender was looking at.
Do not
- Sort by an internal field, such as insertion order, and present it as relevance.
- Reset to the default sort after the reader opens an item and comes back.
- Offer a sort the data cannot support, such as popularity with no usage data behind it.
- Sort nulls silently to the top. Decide where missing values go and say so.
In practice
- i.
Unstable sort ordering
Data tablesSorting by a column with many equal values without a tiebreaker makes rows jump between page loads. Users read this as a bug and lose confidence in the data.
- ii.
The tie that moved
Stable sortingSorting by a column with many equal values reshuffled the tied rows on every page load, so the item a reader was tracking moved between refreshes. A stable secondary key, such as id, removes it.
Commonly confused with
Close neighbours that get substituted for each other. The difference is stated first, then the condition that picks one over the other.
Filtering
PatternRemoving items that fail a stated attribute constraint.
Key difference
Filtering changes which items are in the set. Sorting changes only their order, and nothing ever leaves. Readers reach for sort when they mean filter, and then wonder why the list is still so long.
Use Sorting when
- Every item is still a candidate.
- The question is which is best, newest or cheapest.
- The reader wants a ranking rather than a shorter list.
Use Filtering when
- There are too many results to work through.
- Whole categories are irrelevant to this reader.
- The count afterwards is information worth showing.
Local chart
PAT·005 · Region III · Grid E2
This entry and the entries it is stated to connect with. Each line is labelled with what the connection means.
Continue from here
Each link says what the connection is, so you can tell a principle from an alternative from a thing people mix this up with.
Applies when you are designing
Principles behind this
The reasoning this solution is an application of.
- Default EffectBIAS·004 · Cognitive bias
- Natural MappingPRIN·008 · Principle
- Choice OverloadPSY·002 · Psychology
Often used with
These usually appear in the same screen or the same decision.
- Data TableCMP·025 · Component
- PaginationCMP·021 · Component
- SearchPAT·002 · Pattern