Problem/Motivation
Because there have been problems in the past with the required field asterisk not meeting AA contrast requirements, we should review every core theme and check any use case where the background color might be different.
Proposed resolution
Improve colour contrast for the field required asterisk where needed
Needs a contrast of > 4.5:1
Finding a single colour which has sufficient contrast against white, pale grey, and the dark grey of off-canvas could be tricky.
So perhaps we need 2 colours:
One which has sufficient contrast against white and pale grey backgrounds.
Another colour which has sufficient contrast against the dark grey backgrounds.
Review results
Off Canvas (same for every theme)
Asterisk: #e5e5e5 Background: #444444
Contrast ratio 7.73:1: 👍
Claro
Asterisk: #dc2323 Default Background: #FFFFFF
Contrast Ratio: 4.87:1 👍
Default Asterisk: #dc2323 Collapsible element background (f.e. inside sidebar accordion): #F8FAFB
Contrast Ratio: 4.65:1 👍
Olivero
Asterisk: #232494 Default (AND collapsible container) Background: #FFFFFF
11.99:1 👍
Umami
Asterisk: #ee0000 Default (AND collapsible container) Background: #fbf5ee
4.18:1 👎
Umami maintainer @shaal was asked if changing this to #e40000 would be OK, and he said yes. This would bring it to 4.51:1.
Remaining tasks
patch
User interface changes
Colour contrast improvement.
Original issue summary:
Here for reference, but is outdated:
The Classy theme provides a red asterisk to indicate required form inputs. See required.svg in
core/themes/classy/css/components/form.css.</del> (Classy theme no longer in core)
<code>This has sufficient contrast against the white page background in the Seven theme. #ee0000-on-white has contrast ratio 4.53 : 1.
(Seven theme no longer in core)
However in other places, this asterisk has insufficient contrast:
-
In the off-canvas dialog, we find this asterisk against a dark grey background. #ee0000-on-#444444 has contrast ratio 2.14 : 1. The following screenshot comes from layout builder's add-block dialog. The title and formatter inputs are required.(Off canvas CSS has been updated since and no longer exhibits this problem)
-
In Seven's entity-meta sidebar on the node form, the asterisk can potentially appear against a pale grey background. #ee0000-on-#edede8 has contrast ratio 3.85 : 1. The standard profile doesn't have any required inputs in the node form sidebar, so the following screenshot is a mockup, made by adding the .form-required class to a label using the browser dev tools.
Note: this asterisk is an SVG image of a common typographical character, but it could just as easily have been implemented with the ASCII text character. So there is a question of whether it falls under WCAG SC 1.4.3 "Contrast (minimum)" as text, or SC 1.4.11 "Non-text Contrast" as an image. In this context, let's class it as text; it's a typographical character, presented inline as part of a text label.
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | Screenshot 2023-05-06 at 2.11.23 PM.png | 156.89 KB | smustgrave |
| #22 | Screenshot 2023-05-06 at 2.10.10 PM.png | 153.29 KB | smustgrave |
| #21 | umami-before-after.png | 57.4 KB | bnjmnm |
| #20 | 3040673-19.patch | 2.78 KB | bnjmnm |
| #17 | Screenshot-after-3040673-15-patch.png | 1.36 MB | varun verma |
Comments
Comment #2
mgiffordHow did we miss that? Now changing the red is an option, but so is adjusting the background color. I like the options presented here:
1. #444444 is difficult. You could use #FE928C-on-#444444 but someone who knows & cares about colors should make that choice.
Are there options with #444?
2. Option for the background #edede8 from Tanaguru.com
We could move to #D5190A-on-#edede8 as recommended above.
Comment #3
bnjmnmcore/themes/classy/css/components/form.cssnow uses an svg with the color #D60000Added a style to off-canvas css so the asterisk there is now #FF9494 to account for the darker background.
The resulting contrast ratios:
#D60000 on #EDEDE8 4.63:1
#D60000 on #FFFFFF 5.44:1
#FF9494 on #444444 4.59:1
Screenshots attached.
Comment #5
bnjmnmAdding needs accessibility review tag, and hoping this can land before #3050389: [META] Remove dependency to Classy from core themes progresses too much as it would eventually require changing many additional files to achieve the same fix.
Comment #8
mgiffordLinking open issues from the CivicActions Accessibility - VPAT.
Comment #13
smustgrave commentedNeeds accessibility review.
Also classy has been removed from D10 so need to see if this is an issue in claro or other themes
Comment #14
mgiffordComment #15
gauravvvv commentedAdded an asterisk svg with the color #D60000, Updated the existing icon. Attached the patch. Please review
Comment #16
varun verma commentedComment #17
varun verma commentedI have applied patch #15 here Added an asterisk svg working fine, Screenshots are attached.
Comment #18
bnjmnmI regularly complain about an issue having too many screenshots, so rejoice at the fact that THIS ISSUE NEEDS SCREENSHOTS 😎😎😎😎😎😎
The issue summary is also referencing seven, a theme no longer in Drupal. The issue summary should summarize where the required asterisk is currently experiencing problems so we can check against it. For example, off-canvas was mentioned.
This issue does not necessarily have to account for EVERYWHERE this is a problem, because we can always fix more in followup issues, but it should be clear about what the scope of problem being solved here is.
Comment #20
bnjmnmCore has changed quite a bit since this issue was filed, so #15 is targeting an issue that is no longer an issue.
I updated the issue summary with an assessment of the asterisk contrast and found that Umami is the only place where this needs to be addressed.
Comment #21
bnjmnmUmami before and after
Comment #22
smustgrave commentedFail
Pass
Don't think Drupal worries about AAA. Know most agencies just care about AA.
Comment #24
smustgrave commentedrandom
Comment #26
smustgrave commentedUnrelated failure
Comment #29
mgiffordWould love to see this get in.
Comment #33
lauriiiCommitted 676c1da and pushed to 11.x. Backported all the way to 10.1.x. since this only changes Umami. Thanks!