Non-text contrast (WCAG 1.4.11): how to check a border, focus indicator or icon when DevTools shows no ratio

A developer who clicks the color of a border in Chrome DevTools gets no contrast ratio at all. The color picker only calculates one for the color property of text. For a border, a focus outline or an icon, the element's color comes from the code and the background's from the eyedropper. A contrast checker then judges the pair against 3:1, the minimum WCAG 1.4.11 sets for non-text contrast.
Measure what DevTools doesn't
#Non-text contrast (WCAG 1.4.11): which colors to compare for a border, focus indicator or icon
Non-text contrast compares a piece of interface, or an icon, with the color right next to it. The minimum is 3:1.
It covers whatever shows that a UI component is there, its state, such as keyboard focus, and any icon that carries information. Below 3:1, someone with low vision can miss the control entirely. The rule is success criterion 1.4.11 of the Web Content Accessibility Guidelines (WCAG). It sits at Level AA, the level laws point to. The Americans with Disabilities Act rule covering state and local government websites requires WCAG 2.1 at that level, this criterion included. In Europe, EN 301 549, the standard companies use to show they meet the European Accessibility Act, requires it too.
The color that counts is the one touching the element from the outside. The W3C, which writes these guidelines, uses a white input with a dark border on a white page: the adjacent color there is the white outside the field. On the Thistle Bindery newsletter form, that makes four pairs. The email field's border and its focus outline, drawn 2 px further out, both sit on the cream page. The two icons sit on the white of their buttons.
Marker 1. The email field in focus, with its gray border and light blue outline. Marker 2. The search button, a gray magnifier on white. Marker 3. The close button, a gray X on white.#When a form field border needs 3:1?
A field's border only gets judged when it's the one thing showing the field, the only case where the W3C asks it for 3:1. On the demo, it is. We took the label out on purpose so the border would stand alone. Nothing is typed inside, and the field's white barely stands out from the page, at 1.10:1.
A real form keeps its "Email address" label on screen, though. The demo names the field only in code, for screen readers (aria-label), which tells nothing to someone looking at an empty box. With that label in place, the border would no longer need 3:1.
Everyday cases fall outside the threshold too: a disabled element, or an icon whose meaning is spelled out next to it. The same goes for the browser's default focus outline left as is, which only has to stay visible (the other exceptions).
Focus visible: how to style the focus indicator in CSS
#How to check non-text contrast in Chrome DevTools?
DevTools only works out a contrast ratio for the color property. It still shows both colors of a border or an icon, and the verdict at 3:1 comes from a contrast checker.
#Why the color picker shows no contrast ratio for a border?
It all starts with a tiny square. On the Styles tab, the field's border has a color swatch in front of #c9c6be, like a text color. We clicked it, and the usual color picker opened without its Contrast ratio row.
The focus outline gets the same silence, and so does an SVG icon, even one that takes its color from its button. The outline's rule only shows up once the :hov button turns on the focus state. The reason lives in DevTools' source code: the contrast section is only added to a property named exactly color. We ran these tests in Chrome 156.
Marker 1. The declaration border: 1px solid #c9c6be and its color swatch. Marker 2. The open color picker, with no contrast section.#Where to read the border or icon color?
- Read the element's color on the Styles tab, in its CSS. An icon that inherits its button's color shows it in the "Inherited from" section.
- Pick the background with the eyedropper, right next to the element: with the picker open, press C, then Esc to leave (the same move, step by step, for text). The click also replaces the color of the line you opened, until the page reloads. When the CSS sets the background, Styles shows it too, like the button's
#ffffff.
Why not drop the eyedropper on the icon itself? The W3C asks for the color in the code, because the screen's edge smoothing (anti-aliasing) can draw a thin line much paler than it is. We counted on the demo's magnifier: 67 of its 133 pixels come out lighter than the code color, down to 1.23:1 where the code gives 2.61:1. On a standard display, then, the eyedropper lands on a pixel that's too pale about every other time. On a high-density screen, the share changes. On the field's border, only the rounded corners fade.
#Compare the two colors in a contrast checker
That leaves the math. Paste the element's color as the text color of a contrast checker, the background as the background color, and judge the ratio at 3:1. On the demo, the field's border against the page gives a contrast ratio of 1.55:1.
Marker 1. The ratio shown, 1.55:1. Marker 2. The Interface row, marked Fail.
How to check the contrast ratio of text in Chrome DevTools
#Non-text contrast examples: the verdict on a real form, and the fix
On the demo form, the field's border, its focus outline and the search magnifier all fall short of 3:1, while the close button's X passes. The outline's verdict depends on the standard. For the W3C, the dark text cursor blinking in the field already shows focus, as long as the cursor itself reaches 3:1. France's RGAA, the standard French sites are audited against, is stricter: focus has to change the field's outline or background, at 3:1 or more.
#The verdict, element by element
| Element | Element, then background | Ratio |
|---|---|---|
| Email field border | #c9c6be#f6f4ef | 1.55:1 |
| Field focus outline | #9ec5fe#f6f4ef | 1.61:1 |
| Search magnifier | #a3a09a#ffffff | 2.61:1 |
| Element | Element, then background | Ratio |
|---|---|---|
| Close X | #8f8b84#ffffff | 3.39:1 |
#Icon contrast: SVG or icon font, and what the DevTools verdict is worth
The X is the one that caught us off guard. Written as a character, the way an icon font does it, it makes DevTools treat its button as text. The picker does show "Contrast ratio 3.39". Then it puts a red crossed-out circle on "AA: 4.5", the threshold for regular text, and suggests darkening the X to #78756f. For the W3C, the "X" of a Close button is a non-text symbol, judged at 3:1, so at 3.39:1 the X passes.
The DevTools verdict follows the font size. At 24 px, which DevTools counts as large text, the same X gets a check mark on "AA: 3.0". The non-text contrast threshold doesn't depend on any size.
Marker 1. The contrast ratio shown, 3.39. Marker 2. The AA: 4.5 row and its red crossed-out circle.The SVG magnifier ends up with the same text verdict, by a longer road. The picker for its button's color first says "No contrast information available". Its contrast section still has a second eyedropper, next to the "Aa" preview, for the background. One click on the button's white, and 2.6 shows up, judged against 4.5 as well. That number is right, since DevTools computes it from the CSS color. Only the verdict needs redoing at 3:1.
#Fixing each color
Darken each color without changing its hue, up to the first shade that reaches 3:1, then copy it into the stylesheet: DevTools forgets its edits on reload.
Avoid
Marker 1. The email field, its border #c9c6be and its outline #9ec5fe. Marker 2. The magnifier #a3a09a on its white button..field { border: 1px solid #c9c6be; }
.field:focus-visible { outline: 2px solid #9ec5fe; }
.search { color: #a3a09a; }Correct
Marker 1. The email field, its border #938d7e and its outline #3e8bfd. Marker 2. The magnifier #98948e on its white button..field { border: 1px solid #938d7e; }
.field:focus-visible { outline: 2px solid #3e8bfd; }
.search { color: #98948e; }We stopped just above 3 on purpose, because the threshold doesn't round: per the W3C, 2.999:1 fails. For a 1 px border or a thin-stroked icon, though, the W3C recommends a thicker line or a margin above the minimum, since edge smoothing fades thin shapes. The field had another way out. A background at 3:1 against the page would show it on its own, and its border would have no threshold.
The X stays as it was. The color DevTools suggested, #78756f, climbs to 4.59:1, darker than an icon needs.
To try a border or icon color before coding it, paste it with its background into our contrast checker: the Interface row gives the verdict at 3:1.


