Skip to content

VIS-004 Give the edges and state marks of controls, and the parts of graphics people need, 3:1 contrast

Level
Rule
Verdict
Requirement
Status
proposed, version 1.1.0

Rule

The parts people need to see to find a control and tell its state, and the parts of a graphic they need to understand it, reach 3:1 against the colours next to them. Inactive controls, decoration and graphics whose information is also given in text are exempt.

Examples

Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.

Do: Fields and switches you can find

Light theme

  • Email field edge against the page: measuring …
  • Checkbox edge against the page: measuring …
  • Switch track against its panel: measuring …

Dark theme

  • Email field edge against the page: measuring …
  • Checkbox edge against the page: measuring …
  • Switch track against its panel: measuring …
The field and the checkbox use border-input, and the off switch has a bg-input track. Type in the field, tick the box, flip the switch: each part is measured against what touches it, in both themes.

Don't: Edges and tracks that fade away

Light theme

  • Email field edge against the page: measuring …
  • Checkbox edge against the page: measuring …
  • Switch track against its panel: measuring …

Dark theme

  • Email field edge against the page: measuring …
  • Checkbox edge against the page: measuring …
  • Switch track against its panel: measuring …
The same controls with border-border on the field, border-muted-foreground/30 on the checkbox and a bg-muted track on a bg-muted panel. They still work, but you have to already know where they are.

Do: A meter with a gap between segments

Light theme

Storage used: 7.5 GB of 10 GB

  • Photos4.1 GB
  • Videos2.6 GB
  • Documents0.8 GB
  • Photos against the track: measuring …
  • Videos against the track: measuring …
  • Documents against the track: measuring …

Dark theme

Storage used: 7.5 GB of 10 GB

  • Photos4.1 GB
  • Videos2.6 GB
  • Documents0.8 GB
  • Photos against the track: measuring …
  • Videos against the track: measuring …
  • Documents against the track: measuring …
The meter alone tells how full the account is and how it divides, so each segment is 3:1 or more against the track, with a 2 px gap in the page colour between them. The exact sizes also stand in a list beside it.

Don't: Pale segments that touch

Light theme

Storage used: 7.5 GB of 10 GB

  • Photos
  • Videos
  • Documents
  • Photos against the track: measuring …
  • Videos against the track: measuring …
  • Documents against the track: measuring …

Dark theme

Storage used: 7.5 GB of 10 GB

  • Photos
  • Videos
  • Documents
  • Photos against the track: measuring …
  • Videos against the track: measuring …
  • Documents against the track: measuring …
The segments are 20 % tints of the same colours, with no gap. The only text says 7.5 GB of 10 GB, not how much each type takes, so the bar is the one place that says it, and against the track each segment is far below 3:1.

Do: An edge that stays while hovered and pressed

Light theme

  • Edge at rest: measuring …
  • Edge while hovered: measuring …
  • Edge while pressed: measuring …

Dark theme

  • Edge at rest: measuring …
  • Edge while hovered: measuring …
  • Edge while pressed: measuring …
The icon-only Add task button keeps border-input in every look and only adds a fill and an inner shadow. The edge is measured against the page around the button at rest, hovered and pressed, in both themes. Hover and press the live button too.

Don't: A hover that takes the edge away

Light theme

  • Edge at rest: measuring …
  • Edge while hovered: measuring …
  • Edge while pressed: measuring …

Dark theme

  • Edge at rest: measuring …
  • Edge while hovered: measuring …
  • Edge while pressed: measuring …
The same button with hover:border-transparent and active:border-transparent. A hover fill may be faint, but this one leaves an icon with no edge to find it by: the edge is gone, and what is left is the hover fill, about 1.2 to 1.4:1 against the page.

Why

A text field nobody can see is a field nobody fills in. A checkbox whose box fades into the card, a switch whose track blends with the panel, or a chart whose lines are pale on white leaves people guessing what is there and what state it is in. WCAG 2.2, 1.4.11 Non-text Contrast requires 3:1 for the visual information needed to identify a control and its state, and for the parts of a graphic needed to understand it. It is measured against the colours that touch the part. It does not ask for a border on everything: a button with readable text is found by its text, so its container need not reach 3:1. A text field has no text until someone types, so its edge, or a fill that stands out from the page, is what shows it. State marks count too: the tick in a checkbox, the dot in a radio button, the thumb and track of a switch. These may be measured against another part of the control, such as the tick against the box's fill. The criterion does not compare a control's states with each other; a state that differs only by hue is VIS-003a. It does test the parts people need in each state, so a hover or a press may be faint itself, but it may not make an edge people need, a state mark, or a focus or selection cue drop below 3:1. The exception for controls the browser draws unchanged hardly ever applies in a shadcn app, where every control is styled by the author. Where a product has a light and a dark theme, we measure in both. People meet either one, so we treat each as the page; that is our way of applying the criterion, not words in it.

Do

  • Edge fields with border-input, as Justified's Input, Textarea, NativeSelect, Checkbox and RadioGroup do. The contrast test checks input against the page at 3:1 in both themes. Measured further, it gives about 3.3:1 on muted and 3.7:1 on card in the light theme, and 3.5:1 and 4.2:1 in the dark one, so a field on those panels still passes. Which border token to use is VIS-002.
  • Use Justified's Switch as it is: the track is bg-input when off and bg-primary when on, with a thumb in the page colour, and both states keep 3:1.
  • Give an icon-only button's icon 3:1 against what is behind it. On an energy dashboard's toolbar, the Export readings button with a download icon keeps the icon in text-foreground and its name in code (ACT-001b).
  • In a bar chart of Daily use in kWh, give each bar 3:1 against the chart's background.
  • On an account page, a storage meter split into Photos, Videos and Documents shows each segment at 3:1 against the track. Neighbouring segments either differ by 3:1 from each other, or have a 2 px gap in the background colour between them, so each part can be seen. The meter alone tells how full the account is, so it needs the contrast; the exact sizes may also stand in text next to it.
  • Check a product's own chart palette in both themes; shadcn's --chart-1 to --chart-5 are not in Justified's test.
  • Give a status dot 3:1 against the page. Justified's status colours are tested at 4.5:1 as text on the page, so as dots on the page they pass. If a product's own status colour is too light as a dot, darken it, or give the dot an edge that reaches 3:1 against the page.
  • Draw the indicator of a selected tab or row, such as an underline bar or a check, at 3:1 against what is next to it, when that indicator is how people see the state.
  • Measure the centre of a part drawn with a gradient against what surrounds it.
  • Measure the parts people need in every look the control has: at rest, hovered, pressed, selected and focused. A custom select trigger keeps border-input on hover, a checkbox keeps its box edge when the pointer is on it, and a switch's thumb still stands out from its track while pressed.

Don't

  • Edge an Input, a custom select, a combobox trigger or a date picker button with border-border. It measures about 1.4:1 against the light page and 1.5:1 against the dark one.
  • Make a field border-transparent bg-muted/50, or border-0 bg-transparent in a toolbar or a table cell, so that only the placeholder shows where it is. The placeholder is not the field's edge and is gone once someone types.
  • Draw an unchecked checkbox with border-muted-foreground/30, put a bg-muted switch track on a bg-muted card, or draw a slider rail in bg-secondary on the page.
  • Put opacity-50 on an icon button or toggle that still works to mean "off" or "less important". The exemption is for inactive controls only.
  • Draw an icon-only button's icon in text-muted-foreground/50, or a light icon on a tinted toolbar.
  • Add a dark: override for a control's fill and forget its border.
  • Rely on a tooltip or a hover highlight to make chart lines visible. The chart at rest must pass.
  • Give a select trigger, a field or an icon-only outline button hover:border-transparent, so the edge people find it by is gone while the pointer is on it.
  • Put active:opacity-70 on a checkbox, a switch or an icon button. While it is pressed, the edge, icon or marks people need fade with it.
  • Let a hover paint over the focus ring, as with hover:ring-0, or lay a hover fill close to the colour of a selection bar or check.

Exceptions

  • Inactive controls. A control that cannot be used at that moment. When to switch a control off at all is ACT-004 and ACT-005.
  • Information in text. A graphic whose information is also given as text, such as values printed on each bar or a table of the same data, need not reach 3:1 in its parts. The text then follows VIS-001.
  • Decoration and pictures. Decoration, photos and illustrations people do not need in order to understand the content.
  • Hover and press. A hover look, or the look while a control is being pressed, need not reach 3:1 against the control at rest, since the criterion does not compare a control's states with each other; the explanation says this of hover, and treating the pressed look the same is our reading. Neither may make an edge people need to find the control drop below 3:1 against the page or panel around it, nor a state mark or a focus or selection cue drop below 3:1 against what now touches it. A toggle that is on is not covered: that is a state people must identify. Whether to show hover and press looks at all is VIS-008.
  • Text. Text, including axis labels and values in a chart, is VIS-001.
  • Neighbouring rules. The focus indicator is KBD-001, and focus seen through a translucent layer KBD-002. States and statuses told apart by colour only are VIS-003a.

Verdict

Requirement. Only the judges decide; the expert witnesses are shown but do not vote. How verdicts work

Stances on VIS-004
SourceRoleStancePage
WCAG 2.2LawRequires1.4.11 Non-text Contrast
WCAG 2.2LawSupports1.4.1 Use of Color
Material DesignJudge SupportsAccessibility designing: Color contrast
Color roles
Apple Human Interface GuidelinesJudge No position
Carbon Design SystemJudge SupportsAccessibility: Color
Color
Status indicators
GOV.UK Design SystemExpert witness No position
Nielsen Norman GroupExpert witness No position

Each stance links to the page it rests on, read on the date in the source register. This page never repeats what a source says; read the source itself.

History

  • Version 1.1.0, : The hover exception now covers the pressed look too, and no longer lets a hover or press take contrast away from an edge people need, a state mark or a focus or selection cue. A toggle's on state is not covered. A new Do asks to measure every state.
  • Version 1.0.0, : First version.

Last checked against the other rules for conflicts on .

More in Colour and motion: 11 rules and 0 guidelines · All rules