Problem/Motivation
Form labels that are disabled have too low color contrast.

The bold label has a foreground color of #828388 with a background color of #FEFFFE which leads to a contrast ration of 3,8:1. The calculated font size is at 14.223999977111816px. To qualify as large text the text would have to be bold and at least 18.5px therefor it is categorised as regular text and needs a contrast ratio of 4.5:1 to pass.
The select box text has a color of #828388 and a background-color of #F2F2F3 which is a contrast of 3.4:1 with a font size of 16px. The aforementioned contrast ratio passes for large text (requirement 3:1) but fails for regular text (requirement 4.5:1). But with 16 px the displayed text doesn't qualify for large text (requirement either 24px or bold and at least 18,5px).
Same for the non-text contrast of the svg background-image (.form-element--type-select[disabled]). foreground color is #8E929C and background color is #f2f2f3 which leads to a contrast ratio of 2.8:1 but 3:1 is required for non text contrast.
And speaking of non-text contrast the outline of the select box has a too low contrast ratio as well. the border color is #bababf while the background color is #f2f2f3 which leads to a contrast of 1.7:1 but 3:1 is required. (*disclaimer with outlines and borders i am not entirely sure if it is necessary to get things to pass or not)
The edit source description (id is edit-source--description) has a color of #828388 with a background color of #FEFFFE that is a contrast ratio of 3.8:1. To pass with a calculated font-size of 12.640000343322754px the ratio would need to be 4.5:1 for regular text.
Steps to reproduce
- Install the Media module in Core
- Go to the image field in admin/structure/media/manage/image or one of the existing media types
- Check the media source section to see that the contrast has been updated to meet WCAG 2.0 AA (should be #75767b rather than #828388)
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | Screenshot 2024-05-01 at 8.53.36 AM.png | 274.76 KB | gauravvvv |
| #27 | Screenshot 2024-05-01 at 8.52.26 AM.png | 26.14 KB | gauravvvv |
| #24 | Screenshot 2023-05-19 at 2.26.24 PM.png | 152.15 KB | smustgrave |
| #23 | Edit-Image-amiet-learning.png | 113.27 KB | amietpatial |
| #22 | 3266299-22.patch | 1.52 KB | gauravvvv |
Issue fork drupal-3266299
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3266299-claro-form-labels
changes, plain diff MR !2313
- 3266299-form-labels
changes, plain diff MR !7861
Comments
Comment #2
rkollerComment #3
mherchelThe label is this color because of the
.is-disabledCSS class on it. Updating the issue summary.I somewhat recall having a discussion in the Olivero issue queue where it is okay to have disabled text not meet contrast criteria... but I'm not 100% sure.
I'm going to cross post this in the Drupal Slack #accessibility channel for feedback
https://drupal.slack.com/archives/C2ANFUGGG/p1649851821588239
Comment #4
ckrinaI commented this on the duplicated issue #3266760: Greyed out authenticated user role in user profile has a too low color contrast:
The element
.form-item__label.is-disabledis using the variable--input--disabled-fg-color. It is defined in thevariables.pcss.cssfile on line 104 as--input--disabled-fg-color: var(--color-gray-600). Instead of--color-gray-600it should be using--color-gray-700, with a contrast ratio of 4.53. It'll solve this existing problem in all disabled labels.That issue can be addressed here, changing the color for all elements involved.
Comment #5
mikemai2awesome commentedBringing some comments from Slack:
@Mike Mai:
@mherchel:
@Mike Mai:
@ckrina:
@Mike Mai:
Comment #7
ckrinaWe discussed this during the weekly Claro meeting. Here is the thread: https://drupal.slack.com/archives/C2ANFUGGG/p1649851821588239
@andrewmacpherson added this feedback:
So I would suggest next steps are, based on @andrewmacpherson and @mikemai2awesome feedback:
--color-gray-700, that complies with the 4.5:1 contrast requirement.Comment #11
stueybrock commentedPushed change to disabled colour
Comment #13
smustgrave commentedFixed CI error.
Comment #14
mgiffordI tried to test this in SimplyTest.me but couldn't seem to get the patch to apply there. Not sure if its just too long since I did this, or if there is another bug in SimplyTest.me.
Wanted to raise this related issue:
Title: WCAG 1.4.3: Ensures the contrast between foreground and background colors meets WCAG 2 AA contrast ratio thresholds (em)
Tags: Accessibility, WCAG 1.4.3, color-contrast
Issue: Ensures the contrast between foreground and background colors meets WCAG 2 AA contrast ratio thresholds (color-contrast - https://accessibilityinsights.io/info-examples/web/color-contrast)
Target application: Edit Image | Drush Site-Install - https://master-5cugo26zvm3mikgfxjfznly18jm9g8jb.tugboatqa.com/admin/stru...
Element path: #edit-source--description > em
Snippet: The media source cannot be changed after the media type is created.
How to fix:
Fix any of the following:
Element has insufficient color contrast of 3.78 (foreground color: #828388, background color: #ffffff, font size: 9.5pt (12.64px), font weight: normal). Expected contrast ratio of 4.5:1
Environment: Microsoft Edge version 105.0.1343.50
====
This accessibility issue was found using Accessibility Insights for Web 2.34.1 (axe-core 4.4.1), a tool that helps find and fix accessibility issues. Get more information & download this tool at http://aka.ms/AccessibilityInsights.
Comment #15
smustgrave commentedSo this is how I tested
Drupal 9.5 standard install
Making claro my default theme
Using https://www.drupal.org/project/examples
Ajax submodule specifically
Went to examples/ajax-example/dependent-dropdown
Using color contrast analyzer verified the failure.
Applied MR
Verified color contrast now passes.
Comment #17
mgiffordTagging for WCAG 1.4.3
Comment #18
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #19
smustgrave commentedThis actually appears to have already been fixed. If anyone can confirm we can close this out.
Comment #20
sahil.goyal commentedColor contrast is changed and updated after applying MR on 9.5x but it not getting applied to the D10.0.x it still shows old color contrast as
color: #828388. i think it needs to be updated..Comment #21
rkollerwithout applying the patch this isn't fixed at all. i've rechecked with a current install of 10.1.xdev. the media source label still has a color contrast of 3,78:1 (#828388). i have saved me to recheck the rest of the color contrasts. the issue is still relevant and necessary. only problem is the patch doesn't apply anymore with composer patches.
one idea. i am not really a fan of disabled interface elements. they have those a11y implications which were the reason this issue was initially created plus they are potentially confusing from an ux perspective. in the case of the set media type why not drop the greyed out display for disabled select form elements and instead make it an informal badge? i've just chopped it together in devtools. i've just removed the is-disabled classes and switched off the background image for the pointing down arrow.

would definitely need design input but i just wanted to communicate the general gist. the user is unable to make adjustments and is just presented with the media source for the current media type. the description underneath would have to be slightly adjusted. but from my point of view that would fix at least the disabled form media source form elements problems. it would be clear to the user no interaction is necessary, what the media source is and the contrast issues would be avoided.
Comment #22
gauravvvv commentedPatch #13, no longer applies to 10.1.x. I have provided updated patch for same. please review
Comment #23
amietpatial commented#22 applied successfully, attaching the screenshot of what I see on 10.1.0-dev
Comment #24
smustgrave commentedUsing a contrast tool the label passes but not the field.
Comment #27
gauravvvv commentedAfter patch

Here is the results from contrast tool.

Comment #28
smustgrave commentedBelieve this is good
Comment #34
nod_Committed and pushed e8298e81ba to 11.x and 22b06e0042 to 11.0.x and 8e344072b3 to 10.4.x and 271a556170 to 10.3.x. Thanks!
Comment #35
amietpatial commented