Repository navigation
Don't rely on color alone (Web HIG tip #20) #38
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.
On example.com/orders, each row has a green or red dot next to the order number. Shipped is green. Delayed is red. There is no word, no icon, and no pattern. Someone who cannot tell those colors apart, or who hears the page instead of seeing it, cannot tell the two rows apart.
Web HIG tip #20 (Quick #60): Never rely on color alone to communicate meaning — pair with icon, text, or pattern.
Why it matters
Color is a useful cue. It is a poor only cue:
Quick #60 is Quick-only guidance (no rule ID of its own). For errors, §2.5, Error UX Taxonomy is more specific: errors MUST NOT rely on color alone, and each error MUST include text and, where applicable, an icon or pattern. Required-field markers have a related Quick item (#55), which tip #4 already covered.
Before and after
These table cells use fill color as the only status:
Give the status a visible word. Keep color if it helps, and add a shape or pattern so the meaning does not depend on hue. This is a status-label illustration, not a complete orders table or a design system:
The word "Shipped" or "Delayed" is what people read and what assistive technology can speak. The border style is a second non-color cue, not a substitute for the text. It is a modest visual backup; check that it still has enough contrast. In forced-colors, the border color is usually replaced, but a solid versus dashed style typically remains. A distinct icon shape can play that same visual backup role for sighted users, including people who cannot tell hues apart. If the icon is the only status, give it an accessible name, such as
alton animgorrole="img"witharia-label. If the word is already there, mark the icon decorative, for example witharia-hidden="true". An unlabeled icon still leaves the status silent to a screen reader, even when the shape is clear on screen.This snippet does not set a contrast procedure, a palette, or a component library. Check the text and non-text contrast of your own colors in each supported scheme. Do not treat a passing contrast check as proof that the meaning is also clear without hue.
Do this instead
Quick check for your app
Open a test copy of example.com/orders, or any view that uses status, filters, or errors. Turn the display to grayscale, or look at a screenshot in grayscale, and see whether shipped and delayed (or success and failure) are still distinguishable. Then move through the same view with a screen reader your audience uses, and confirm each status or error has a name. If forced-colors is in your supported matrix, check that path too. Suitable automated checks can flag some contrast issues or missing names; they cannot tell you that every color-coded chart, badge, or error still makes sense without hue. Pair them with a manual pass. A green suite is evidence for what it actually exercised, not proof that color is never the only cue.
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