Problem/Motivation
The disabled form labels that appear under the "secondary" node settings in the Seven theme do not meet WCAG AA section 1.4.3 requirements for text contrast.
Steps to reproduce
- Use the Standard install profile
- Login to Drupal 8
- Navigate to /node/add/article. The Seven theme should be in use.
- Ensure that there is at least one disabled field in the node meta data settings in the right-hand sidebar (or, manually set one to disabled using dev tools).
- TIP: add the
form-disabledclass to thediv.form-itemwrapper.
- TIP: add the
- Run DAP Chrome plugin or other WCAG compliance checker on page. See a message similar to the following.
"Minimum contrast of 4.43 with its background is not sufficient to meet WCAG AA requirements for text of size 13.008px and weight of 400."
Proposed resolution
Review current colors and backgrounds for form labels within secondary settings and determine a suitable change that is in line with the Seven theme styles that also passes WCAG AA.
Proposal: darken the disabled form label from #737373 to #686868.
Remaining tasks
Update .form-disabled in core/themes/seven/css/components/form.css, change the color: #737373; to color: #686868;
User interface changes
Update Seven secondary disabled label styles to increase contrast for disabled secondary field labels.
Stable and Classy themes are NOT affected.
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | Untitled.png | 211.25 KB | sahil432 |
| #8 | 2930542-8.patch | 422 bytes | sahil432 |
| Screen Shot 2017-12-13 at 11.00.53 AM.png | 188.81 KB | sdewitt |
Comments
Comment #2
sdewitt commentedUpdated summary.
Comment #3
sdewitt commentedChanged version to 8.5.x-dev
Comment #4
andrewmacpherson commentedThanks for reporting this @sdewitt.
This styling happens when the wrapper DIV has the
.form-disabledclass. I've update the steps-to-reproduce to mention this.The background colour comes from a transparent CSS background-image linear-gradient, but using an eyedropper I figured it works out as #ECECEC in Firefox. The foreground text colour is #737373, so the resulting contrast is 4:1 (according to Lea Verou's Contrast Ratio - https://leaverou.github.io/contrast-ratio/#%23737373-on-%23ececec). Note: this is a different figure to the one @sdewitt reported, but still less than the recommended 4.5:1 value.
I propose we fix this by darkening the form label to #686868, which gets a ratio of 4.7:1 against #ECECEC on the Lea Verou tool. This slightly exceeds the required 4.5:1, but the the background colour is a CSS linear-gradient and this extra margin is intended to cover the discrepancy we've seen when measuring with different tools.
Note that WCAG SC 1.4.3 Contrast (minimum) has an exemption for "inactive user interface components". I'm unclear whether this applies to the form
<label>or just to the<input>. SInce it only narrowly misses the required contrast, we may as well just darken it.Can you tell us more about which tool this is? I Googled the phrase, but found an unrelated "download accelerator" extension. All the colour checker tools I tried don't handle the transparency from CSS background-image.
Update: I see it's the IBM DAP Plugin, which you mentioned in #2034915-14: [meta] Track progress in WCAG 2.0 conformance. I've never tried that one yet.
Comment #5
andrewmacpherson commentedA very simple patch is needed, suitable for a first-time patch contributors.
Tagging for the upcoming Drupal Global Sprint Weekend at the end of January.
Polite request: if you already have D8 commit credits, please consider leaving this issue for a first-time contributor.
Comment #6
andrewmacpherson commentedComment #7
sahil432 commentedComment #8
sahil432 commentedCreated my first patch and provided screenshot for the same.
Comment #9
sahil432 commentedForgot to add screenshot
Comment #10
andrewmacpherson commentedPatch #8 and screenshot are correct.
I tested this manually, since D8 core doesn't have any disabled fields in the node meta-data. When the
.form-disabledclass is present, the label now has a color contrast of 4.7:1.Thanks @sahil432 and @sdewitt, this is a nice attention to detail and a great first core contribution.
Comment #14
lauriiiCommitted 957ff36 and pushed to 8.6.x, also cherry picked to 8.5.x. Thanks!