Repository navigation
fix(css): outline contrast is governed by SC 1.4.11, not text contrast - #45769
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Not a maintainer, just reading through open PRs. The substance here looks right to me: SC 1.4.3 is scoped to text, and the large-text exemption ("18.66px and bold") never had a meaning for an outline, so carrying it on this page was actively misleading. Three small things I noticed. "An outline is a user interface component rather than text" I think this overshoots slightly. An outline isn't itself a UI component; it's a graphical indicator of a component's state. That distinction matters here because 1.4.11 exempts pure decoration, so an outline on a non-interactive element isn't in scope at all, whereas the current phrasing reads as though every outline is covered. Scoping it to the focus case would avoid that:
The Understanding link now appears twice The new paragraph links The dropped explanation of what the ratio is measured from The old sentence opened with "Color contrast ratio is determined by comparing the luminosity of the text and background color values", and the replacement doesn't carry any version of that over. For a reader who arrives without knowing what the two inputs to a ratio are, that clause was doing some work, so a short form of it might be worth keeping. The "adjacent colors include both the background outside the element and the element's own background" addition is a good one. That's the case I'd expect most authors to get wrong. |
estelle
left a comment
There was a problem hiding this comment.
Thanks for addressing this issue. I think we can just remove the old information and don't need to mention text, so suggested some tweaks.
| Custom [focus styles](/en-US/docs/Web/CSS/Reference/Selectors/:focus) commonly involve making adjustments to the {{cssxref("outline")}} property. If the color of the outline is adjusted, it is important to ensure that the contrast ratio between it and the background the outline is placed over is high enough that people experiencing low vision conditions will be able to perceive it. | ||
|
|
||
| Color contrast ratio is determined by comparing the luminosity of the text and background color values. In order to meet current [Web Content Accessibility Guidelines (WCAG)](https://www.w3.org/WAI/standards-guidelines/wcag/), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. Large text is defined as 18.66px and [bold](/en-US/docs/Web/CSS/Reference/Properties/font-weight) or larger, or 24px or larger. | ||
| An outline is a user interface component rather than text, so the text contrast requirements of [Success Criterion 1.4.3](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum) do not apply to it. [Success Criterion 1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast) requires a contrast ratio of at least 3:1 between the outline and the adjacent colors it sits against. Where the outline is used as a focus indicator, note that the adjacent colors include both the background outside the element and the element's own background, because the outline may border both. |
There was a problem hiding this comment.
Outline is a visual indicator, not a ui component. how about:
| An outline is a user interface component rather than text, so the text contrast requirements of [Success Criterion 1.4.3](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum) do not apply to it. [Success Criterion 1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast) requires a contrast ratio of at least 3:1 between the outline and the adjacent colors it sits against. Where the outline is used as a focus indicator, note that the adjacent colors include both the background outside the element and the element's own background, because the outline may border both. | |
| An outline is a visual indicator. In order to meet current [Web Content Accessibility Guidelines (WCAG)](https://www.w3.org/WAI/standards-guidelines/wcag/), [Success Criterion 1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast) requires a contrast ratio of at least 3:1 between the outline and the adjacent colors it sits against. Note that when the outline is used as a focus indicator, the adjacent colors include both the background outside the element and the element's own background when the outline borders both. |
|
Preview URLs (1 page) External URLs (2)URL:
(comment last updated: 2026-09-29 16:17:07) |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Applied your suggestions, thanks. |
estelle
left a comment
There was a problem hiding this comment.
Thank you. Also, congratulations on your first merged MDN content PR. Welcome to he team!
Description
The Accessibility section of
outline-colorstates the requirements for text contrast on a property that colors an outline. An outline is a user interface component, not text, so Success Criterion 1.4.3 Contrast (Minimum) does not apply to it. The applicable criterion is 1.4.11 Non-text Contrast, which requires 3:1.The current wording is also actively misleading in two ways:
MDN already documents this correctly on the two pages a reader is most likely to arrive from:
:focusand:focus-visibleboth cite SC 1.4.11 and 3:1. This change removes the contradiction.The replacement paragraph also notes that a focus outline may border both the page background and the element's own background, so both count as adjacent colors. That follows from the "adjacent colors" wording in 1.4.11 and is the case authors most often get wrong.
The stale reference to the WCAG 2.0 Understanding document for SC 1.4.3 is replaced with the WCAG 2.2 Understanding document for SC 1.4.11.
Motivation
An author following this page today can ship a focus indicator built to the wrong criterion, and will get a different answer from this page than from the
:focuspage.Single file, single section, no change to the first paragraph or to the two remaining links.