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:

  1. 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)
    Only local images are allowed.
  2. 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.
    Red required asterisk on a pale grey background.

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.

Comments

andrewmacpherson created an issue. See original summary.

mgifford’s picture

How 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.

bnjmnm’s picture

Status: Active » Needs review
StatusFileSize
new38.92 KB
new12.49 KB
new29.14 KB
new3.46 KB

core/themes/classy/css/components/form.css now uses an svg with the color #D60000
Added 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.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

bnjmnm’s picture

Adding 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.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

mgifford’s picture

Issue tags: +vpat

Linking open issues from the CivicActions Accessibility - VPAT.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Component: Classy theme » Claro theme
Status: Needs review » Needs work

Needs accessibility review.

Also classy has been removed from D10 so need to see if this is an issue in claro or other themes

mgifford’s picture

Issue tags: +WCAG 143
gauravvvv’s picture

Status: Needs work » Needs review
StatusFileSize
new4.82 KB

Added an asterisk svg with the color #D60000, Updated the existing icon. Attached the patch. Please review

varun verma’s picture

Assigned: Unassigned » varun verma
varun verma’s picture

Assigned: varun verma » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.12 MB
new1.36 MB

I have applied patch #15 here Added an asterisk svg working fine, Screenshots are attached.

bnjmnm’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs screenshots, +Needs issue summary update

I 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.

bnjmnm credited shaal.

bnjmnm’s picture

Title: Red asterisk for required fields fails WCAG contrast minimum against grey backgrounds » Audit & fix Red asterisk for required fields WCAG contrast minimum
Component: Claro theme » CSS
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs accessibility review, -Needs screenshots, -Needs issue summary update
StatusFileSize
new2.78 KB

Core 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.

bnjmnm’s picture

StatusFileSize
new57.4 KB

Umami before and after

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative
StatusFileSize
new153.29 KB
new156.89 KB

Fail

fail

Pass

pass

Don't think Drupal worries about AAA. Know most agencies just care about AA.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 20: 3040673-19.patch, failed testing. View results

smustgrave’s picture

Status: Needs work » Reviewed & tested by the community

random

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 20: 3040673-19.patch, failed testing. View results

smustgrave’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated failure

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 20: 3040673-19.patch, failed testing. View results

mgifford’s picture

Would love to see this get in.

  • lauriii committed 676c1dad on 11.x
    Issue #3040673 by bnjmnm, Gauravvvv, smustgrave, andrewmacpherson,...

  • lauriii committed 2994dd60 on 10.2.x
    Issue #3040673 by bnjmnm, Gauravvvv, smustgrave, andrewmacpherson,...

  • lauriii committed 308e696f on 10.1.x
    Issue #3040673 by bnjmnm, Gauravvvv, smustgrave, andrewmacpherson,...
lauriii’s picture

Status: Needs work » Fixed

Committed 676c1da and pushed to 11.x. Backported all the way to 10.1.x. since this only changes Umami. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.