Problem/Motivation
Originally reported by @smustgrave: #3604037-28: Indicate that grouping elements have child element errors for UX and a11y.
In dark mode, labels for invalid form fields have too low contrast (4.47:1). Results on WebAIM Contrast Checker.
WCAG: SC 1.4.3 Contrast (Minimum) (Level AA)
Steps to reproduce
- Standard installation.
- Use dark mode (set browser or system preferences to prefer dark, or emulate
prefers-color-scheme: dark in devtools).
- Go to
/user/login while logged out. This should be a login form.
- Click the
Log in button without entering any username / password.
This should create form validation errors and red labels for the invalid fields.
- Run a scan with the Axe DevTools or Accessibility Insights browser extensions.
Expected
All red error text has contrast ratio of 4.5:1.
Actual
The red field labels fail color contrast checks.

Proposed resolution
- Use a color for error form labels that has a contrast ratio of at least
4.5:1 against the background.
Suggested: #d67a7a.
- IMO, use the same color for field borders, etc for consistency.
Field borders do pass with the current color because non-text contrast requires a lower ratio, but consistency would probably be desirable.
Here's a before / after screenshot from #ce6060 to#d67a7a.
It has 4.71:1 contrast on the WebAIM Contrast Checker and passes the browser extension test.

Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Comments
Comment #2
kentr commentedComment #3
kentr commentedThough, when I tested
#f39b9dI did not check its contrast with the non-error label color.That's too low, so
#f39b9dwon't work.Comment #4
kentr commentedEven the current color doesn't have
4.5:1contrast to the non-error label color...Here's a proposal, before / after from 59% to 60% lightness (from
#ce6060to#cf6363). It has4.6:1contrast on the WebAIM Contrast Checker.edit: And it passes the browser extension test.
Comment #5
kentr commentedReplacing previous image with cropped version.
Comment #7
kentr commentedComment #8
smustgrave commentedTested this with a color contrast tool and still fails AA :(
Comment #9
smustgrave commentedWhat about #e27878? I asked claude for a good contrast for the 2nd value and this passes AA
Comment #10
kentr commentedSorry about that! The login form I tested has a darker background color for the fields:
#1b1b1d.On other forms with the lighter background, slightly increasing the lightness of the original to
#d67a7apasses with the Axe browser extensions and the WebAIM Contrast Checker (ratio:4.71:1).I made that change in the MR. I defer to others on the color choice.
Before / after screenshots comparing
mainto the MR with#d67a7a:At
/user/login:At
/node/add/article:I also tried the very similar color used in
--admin-color-bg-error(#de7560), but it was more orange and looked odd to me.Comment #11
kentr commentedScreenshot of the results for the MR in the WebAIM Contrast Checker, FTR:
Also updated the STR.
Comment #12
smustgrave commentedPasses!
Comment #13
rkollerone general concern i've voiced over in #3604037-45: Indicate that grouping elements have child element errors for UX and a11y and #3604037-47: Indicate that grouping elements have child element errors for UX and a11y and @kentr asked to raise it over in this issue as well. problem is the default admin theme has a red accent color and that red might be close either in light mode and/or dark mode. i am uncertain if it is a good idea having an accent color being close to the one color signifying errors in a form...
Comment #14
mgiffordIn a new issue, I think it would be good to raise this and propose a new color (or. a process for identifying a new accent color).