Skip to content

fix(css): outline contrast is governed by SC 1.4.11, not text contrast - #45769

Merged
estelle merged 3 commits into
mdn:mainfrom
jsabutis:outline-color-nontext-contrast
Sep 29, 2026
Merged

estelle merged 3 commits into
mdn:mainfrom
jsabutis:outline-color-nontext-contrast

Conversation

@jsabutis

Copy link
Copy Markdown
Contributor

Description

The Accessibility section of outline-color states 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:

  • It tells the reader an outline needs 4.5:1, which overstates the requirement.
  • It offers the large-text exemption ("3:1 for larger text such as headings", "18.66px and bold or larger"), which has no meaning for an outline and could be read as licence to use 3:1 only in some cases. For non-text contrast, 3:1 is the requirement in all cases.

MDN already documents this correctly on the two pages a reader is most likely to arrive from: :focus and :focus-visible both 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 :focus page.

Single file, single section, no change to the first paragraph or to the two remaining links.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jsabutis
jsabutis requested a review from a team as a code owner September 18, 2026 06:04
@jsabutis
jsabutis requested review from estelle and removed request for a team September 18, 2026 06:04
@github-actions github-actions Bot added Content:CSS Cascading Style Sheets docs size/xs [PR only] 0-5 LoC changed labels Sep 18, 2026
@natiD1

natiD1 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

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:

An outline is not text, so the text contrast requirements of Success Criterion 1.4.3 do not apply to it. Where an outline is used as a focus indicator, Success Criterion 1.4.11 Non-text Contrast requires a contrast ratio of at least 3:1 between the outline and the adjacent colors it sits against.

The Understanding link now appears twice

The new paragraph links non-text-contrast inline, and the final bullet links the same URL. The bullet list reads as "further resources", so the inline one is probably the one to drop.

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 estelle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outline is a visual indicator, not a ui component. how about:

Suggested change
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.

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Preview URLs (1 page)

External URLs (2)

URL: /en-US/docs/Web/CSS/Reference/Properties/outline-color
Title: outline-color CSS property

(comment last updated: 2026-09-29 16:17:07)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@jsabutis

Copy link
Copy Markdown
Contributor Author

Applied your suggestions, thanks.

@estelle estelle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Also, congratulations on your first merged MDN content PR. Welcome to he team!

@estelle
estelle merged commit 4371d98 into mdn:main Sep 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:CSS Cascading Style Sheets docs size/xs [PR only] 0-5 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants