Repository navigation
Don't silently show outdated information (Web HIG tip #21) #39
frozonfreak
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Someone opens example.com/orders at lunch and sees "12 open orders." The figure came from an earlier fetch. There is no time, no stale label, and no way to refresh. They start following up with customers whose orders already shipped this morning.
Web HIG tip #21 (Quick #36): Stale data must be labeled or refreshed — do not silently show outdated information.
Why it matters
A number with no freshness cue looks current even when it is not:
Quick #36 is Quick-only guidance (no rule ID of its own). §4.3, Data Freshness & Stale States requires dashboards and data-heavy views to handle explicit freshness states. Fresh data can be shown with no extra indicator. Stale data gets a staleness indicator, and a background refresh is permitted. A refresh in flight should be non-blocking and should preserve the existing data. If the refresh fails, retain the stale data, show an error indicator, and offer a retry. The HIG does not set a universal age threshold for "stale."
Before and after
This heading states a total and gives no clue when it was last known to be true:
Show when the figure was last successfully updated, or another clear staleness label, and let people refresh without wiping the current number. This is a freshness-label illustration, not a complete orders dashboard, and it is not a caching or polling recipe:
The timestamp is an example, not a required format. The
datetimevalue is a valid global date-and-time string for machines; people and screen readers typically get the visible text, so write that text in a form they can interpret, including a date when the time of day alone would be ambiguous. A relative phrase such as "2 minutes ago" also goes stale unless you keep it current, including if you generate it withIntl.RelativeTimeFormat. The script does not perform a real request; a working refresh would request a URL such as https://example.com/orders and then either update the figure and timestamp (and remove the stale caveat) or, on failure, keep the last data, show an error, and leave retry available. That failure path is the Failed refresh row in §4.3.This snippet does not implement polling, HTTP cache rules, or a form-style pending state for the whole page. If the freshness or status text changes in place, put a short live region in the markup first —
role="status"is a polite live region — and update that existing region. Check the announcement with a screen reader your audience uses.Do this instead
Quick check for your app
On a test copy of a dashboard such as example.com/orders, load an older payload, or leave the view open and then fail the next refresh (go offline, or block the request). Confirm a time or stale label is visible, that refresh does not blank the existing figures, and that a failed refresh still shows the last numbers plus an error and a retry. If the freshness or status text updates in place, check it with a screen reader your audience uses. Suitable automated checks can flag a missing freshness label or a missing retry control; they cannot tell you the label is accurate or that the refresh path works. Pair them with a manual pass. A green suite is evidence for what it actually exercised, not proof that outdated figures are never shown as current.
The Web HIG is an open set of guidelines for how the web should behave, not a component library. Design systems define how it looks. The Web HIG defines how it behaves.
All reactions