Problem/Motivation

The inactive tabs in the Seven theme do not meet WCAG AA section 1.4.3 requirements for text contrast.

To reproduce,
1. Login to drupal 8
2. Navigate to /admin/content
3. Run DAP Chrome plugin or other WCAG compliance checker on page
4. See a message similar to the following.

"Minimum contrast of 4.21 with its background is not sufficient to meet WCAG AA requirements for text of size 13.008px and weight of 400."

See attached screenshots for details.

Proposed resolution

Review current colors and backgrounds for inactive tabs and determine a suitable change that is in line with the Seven theme styles that also passes WCAG AA.

Remaining tasks

User interface changes

Update Seven tabs styles to increase contrast for inactive tabs.

API changes

None

Data model changes

None

CommentFileSizeAuthor
#62 Inactive tab contrast.png2.87 MBroberttabigue
#57 After--patch--pic.png22.73 KBvikashsoni
#57 Before--patch--pic.png21.05 KBvikashsoni
#54 2930508-54.patch679 bytesmarcusvsouza
#54 interdiff_2930508-51_2930508-54.txt441 bytesmarcusvsouza
#53 before.png107.81 KBdjsagar
#53 After.png279.68 KBdjsagar
#52 interdiff_2930508-50_2930508-51.txt694 bytesmarcusvsouza
#52 2930508-51.patch796 bytesmarcusvsouza
#50 2930508-50.patch703 bytesguilhermevp
#48 2930508-48.patch702 bytesKapilV
#46 Old tabs.png69.03 KBjenniferhoude
#46 New tabs.png56.76 KBjenniferhoude
#46 tabs.patch713 bytesjenniferhoude
#36 drupal-seven_inactive_tabs_do_not_meet_wcag_aa-2930508-36.patch472 bytesacrollet
#35 Screen Shot 2020-10-15 at 11.57.19 AM.png134.09 KBacrollet
#29 Screen Shot 2018-05-24 at 20.22.17.png52.63 KBlauriii
#29 Screen Shot 2018-05-24 at 20.22.34.png53.52 KBlauriii
#28 seven-active-tab-no-bottom-border.png15.03 KBandrewmacpherson
#23 seven-inactive-tab-bg-colour-change.gif123.68 KBPhil Wolstenholme
#23 2930508-seven-inactive-tabs-do-not-meet-wcag-aa-23-D7.patch502 bytesPhil Wolstenholme
#23 254-253-250-0-7-dev-tools.png99.4 KBPhil Wolstenholme
#17 2930508-seven-inactive-tabs-do-not-meet-wcag-aa.patch508 bytesjds1
#15 Screen Shot 2018-02-04 at 11.59.56 AM.png10.91 KBquidkid
#15 Screen Shot 2018-02-04 at 11.54.49 AM.png7.9 KBquidkid
#14 html-sniffer-test.jpg83.45 KBmlkstff
#13 mlkdev-colour-applied.png101.3 KBmarkconroy
#13 current-seven-inactive-tab.png107.42 KBmarkconroy
#12 2930508-12.patch502 bytesmlkdev
Screen Shot 2017-12-13 at 9.25.36 AM.png87.89 KBsdewitt
Screen Shot 2017-12-13 at 9.25.30 AM.png121.43 KBsdewitt

Issue fork drupal-2930508

Command icon 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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sdewitt created an issue. See original summary.

sdewitt’s picture

Issue summary: View changes
sdewitt’s picture

Updated summary

sdewitt’s picture

Version: 8.4.x-dev » 8.5.x-dev

Changed version to 8.5.x-dev

joelpittet’s picture

Issue tags: +Accessibility
andrewmacpherson’s picture

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Wim Leers’s picture

Issue tags: +Novice
markconroy’s picture

Looks like changing line 44 in tabs.css in Seven's theme will fix this.

Change from
background-color: rgba(242, 242, 240, 0.7);
to
background-color: rgba(244, 244, 242, 0.7);

Now, let's find someone who wants their first core commit!

andrewmacpherson’s picture

Status: Active » Needs work

Thanks Mark. What's the new ratio? Screenshots will help as well.

Is there a reason for these colors having an alpha value, instead of just being RGB? That makes it awkward to test the contrast.
Do the colours still have sufficient contrast in the hover, focus, active styles?

mlkdev’s picture

FileSize
502 bytes

As I see the color contrast ratio with background-color: rgba(244, 244, 242, 0.7) is only 4.21 (foreground color: #0074bd, background color: #edede9), but normal text requires a contrast ratio of 4:5:1.

So I changed the value to background-color: rgba(253, 253, 252, 0.7) for a contrast ratio of exactly 4:5:1 (foreground color: #0074bd, background color: #fdfdfc).

I tested it with chrome audit and aXe, which seems to be a little more accurate than the chrome accessibility audit.

markconroy’s picture

Hi @andrew,

tabs.css in the Seven theme (line 44) uses rgba, so I just did the same.

I got the exact value that I suggested from html_CodeSniffer, it suggested that colour, but thinking about it now, if we also have only .7 opacity, then I guess we'd need a slightly darker colour.

Applying the colours suggested by @mlkdev, I get contrast ratio errors:

Here's the current seven in active tab:
bg colour of inactive tab

Here's what it looks like with @mlkdev's suggestion:
new bg colour of inactive tab

mlkstff’s picture

FileSize
83.45 KB

I'm afraid either you posted the same screenshot twice or my suggestion wasn't applied in your test (it looks to dark on the screenshot). Tested your and my suggestion again with the HTML-Sniffer tool. Seems the HTML-Sniffer is ok with both color suggestions and different tools have fine differences in the results.

With the HTML-Sniffer I got with rgba(244, 244, 242, 0.7) a color contrast ratio of 4.5:1 and with the value rgba(253, 253, 252, 0.7) a color contrast ratio of 4.87:1.

 No error on color contrast report

quidkid’s picture

Status: Needs work » Needs review
FileSize
7.9 KB
10.91 KB

Before: In order to use the WebAIM color contrast checker to take into account the .7 opacity, I took a screenshot and use the the eye dropper tool in Adobe Photoshop to get the background color.

Here are the results from the WebAIM:

Foreground: #0074BD
Background: #EDEDE9

4.23:1 => fail normal text

After: Using the RGBA from #12, I did the same and it passes!

Foreground: #0074BD
Background: #F5F5F2

4.54:1 => passes normal text

mpdonadio’s picture

Assigned: Unassigned » andrewmacpherson
Issue tags: +Needs accessibility review

#15 was part of mentoring for DrupalCampNJ 2018 (please make sure @quidkid gets commit credit when this lands). Here are the screenshots (didn't want to get DREditor setup yet for embed helpers b/c the current problems with it).

Before:

After:

Assigning back to @andrewmacpherson for final review.

jds1’s picture

Hi All!

I was having issues getting the patch in #12 to apply, then I also found that manually changing the values still caused contrast to fail. Here is a new patch with a different background color value.

Now, this totally passes AA but still fails AAA. Are we wanting to comply with AAA here too?

Thanks!

Best,
jds

andrewmacpherson’s picture

@id-jds - thanks for looking at this.

What was wrong with the colour in #12, and how does #17 improve it? The report in #15 says the new ratio from #12 was 4.54:1. What ratio did you find? 4.54:1 is close to the threshold, so maybe there are rounding errors between different tools.

We're not aiming to satisfy level AAA here. The Drupal core accessibility gate aims for WCAG 2.0 level AA

andrewmacpherson’s picture

Aside: this would be a lot easier if it was just RGB. I'm not sure if there's a reason we have so many RGB-A values in Seven, but they're certainly more awkward to test.

jds1’s picture

@andrewmacpherson – of course! I am happy to contribute. I double checked and the color from #12 is passing with 4.74:1 from WAVE Chrome extension. Though I would be happy to reroll #12 or #17 with an AA-compliant RGB value (without the A). Maybe a first step in transition to RGB values in Seven where appropriate?

Thank you!

andrewmacpherson’s picture

Issue tags: +Nwdug_may18

Tagging as a good mentored bug for the NWDUG sprint this weekend.

Phil Wolstenholme’s picture

Assigning this ticket to myself as I'm going to have a look at it as part of the #Nwdug_may18 sprint

Phil Wolstenholme’s picture

Here's a patch with a new background colour of rgba(254, 253, 250, 0.7). This gives a contrast ratio of 4.5:1, so it looks like a good value to use.

The change makes the background lighter, but I think it's still visually distinct from an active tab:

A GIF showing the difference between the previous background colour and the colour proposed in this comment

Screenshot of Chrome's developer tools verifying a contrast ratio of 4.50 for the colour mentioned in this comment

Chrome's dev tools has a colour contrast tool which seems to take RGBA background values into account, which makes testing this issue a lot easier.

@andrewmacpherson and I verified this approach by making sure that the contrast ratio reported by Chrome's dev tools matched the ratio we got by using a colour picker. We used a colour picker to comparing the opaque link colour to the blended background colour shown on my screen. The final colour of the tab is equivalent to #F5F4EF and this passes with a link colour of #0074bd: http://contrast-ratio.com/#%230074bd-on-%23F5F4EF

I also noticed an issue with the contrast of a tab in its focus or hover state, but I've raised a new issue for that: #2972451: Seven's focused/hovered tabs do not meet WCAG AA 1.4.3 for contrast

andrewmacpherson’s picture

Status: Needs review » Reviewed & tested by the community

RTBC: I'm happy with this, we tested the colours together at the sprint. The new colour hits the required contrast ratio spot-on, and has minimal impact on the existing design.

Testing colour contrast is often a pain when transparent backgrounds are involved. The new Chrome colour tools DO seem to calculate the contrast based on the combined background colour of multiple elements with transparency. This is going to be easier in future :-)

@Phil Wolstenholme - thanks for filing the follow-up issue. It's good to fix the contrast for the non-interactive state first, in this issue. The interactive styles can be fixed in a follow-up, otherwise issues like this can drag on.

andrewmacpherson’s picture

Assigned: Phil Wolstenholme » Unassigned

The last submitted patch, 12: 2930508-12.patch, failed testing. View results

lauriii’s picture

Status: Reviewed & tested by the community » Needs review

This does fix the color contrast between the text and the background, but this causes a new problem - after this change it is a lot more difficult to distinguish between active and inactive tabs. I'm not sure if there's an easy solution to fix this. Anyway pushing back to needs review for some further feedback from the accessibility maintainers.

andrewmacpherson’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
15.03 KB

The active vs. inactive tab distinction doesn't rely on colour. They are mainly distinguished by borders:

  • There are borders between the tabs, and these are darker than the background colours of the tabs.
  • The active tab doesn't have a bottom border, it opens out onto the main content.
  • The inactive tabs do have bottom borders, which separate them from the main content. They look like they are behind the active tab.

Even in greyscale, the tabs are clearly separated, and the active one can be identified. This screenshot comes from an achromatopsia (colour blindness) simulation tool:
Primary tabs from Seven theme.

Back to RTBC, I don't think #27 is an issue.

lauriii’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
FileSize
53.52 KB
52.63 KB

I didn't see any difference in achromatopsia mode. This mainly affects the use case where you have the first tab selected because of the border is not quite so visible in that case.

Before:

After:

Feel free to move this back to RTBC if you still feel like this is not a problem.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

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

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

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.

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.

ultrabob’s picture

I'm trying to understand issue #29 raised by @laurii to see if this can be moved forward. Looking at the screenshot, I don't clearly understand the problem, and wonder if maybe this is the reason this hasn't moved in 2 years. Can someone clarify this?

acrollet’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
134.09 KB

Here is a screenshot of @laurii's comparison in achromatopsia mode:

laurii screenshot in achromatopsia mode

I find the difference to be small, and the active tab still easy to distinguish. Based on this I'm moving this issue back to RTBC.

acrollet’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
472 bytes

re-rolled against 9.1 dev.

Status: Needs review » Needs work
acrollet’s picture

Status: Needs work » Needs review

Re-setting issue to Needs Review, re-test passed.

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.

mgifford’s picture

Issue tags: +wcag1413

tagging

markconroy’s picture

How about we set an underline on the text of the active tab, so that way it is distinguished by more than just colour?

I'd also suggest, after 3 years, we get _one_ of the patches from this committed so that Seven will be in a better state than it currently is, and we create a follow-up for the achromatopsia issue (which I guess is not introduced by this fix, but rather is there already and should not be stopping us from incrementally making Seven better).

mgifford’s picture

I like it. We can enhance it later, but this sounds like a very workable solution @markconroy.

jenniferaube made their first commit to this issue’s fork.

jenniferhoude’s picture

FileSize
713 bytes
56.76 KB
69.03 KB

Updated patch #36 to include active tab have css underlined. See images Old tabs and New tabs. Created MR. Moving to review

jenniferhoude’s picture

Assigned: Unassigned » jenniferhoude
KapilV’s picture

FileSize
702 bytes

Fixed Custom Commands Failed.

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.

guilhermevp’s picture

FileSize
703 bytes

Updated patch to fix custom commands failure.

paulocs’s picture

I don't get it if we are using the MR approach or patches in this issue...

marcusvsouza’s picture

I correct the custom erros in the patch of comment #50.

djsagar’s picture

FileSize
279.68 KB
107.81 KB

Hi marcusvsouza,

I applied your patcth i just want to know why you added text-decoration: underline; in li,

background after applied your patch.

Please revert i'm happy if i learn.

Thanks!

marcusvsouza’s picture

My mistake, follows the correct patch.

mgifford’s picture

mgifford’s picture

Issue tags: -wcag1413 +wcag143
vikashsoni’s picture

Applied #54 working fine and applied successfully
Thanks for the patch
For ref sharing screenshots .....

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.

DamienMcKenna’s picture

Assigned: jenniferhoude » Unassigned

As a reminder, the "assigned" field is for indicating that you're currently working on something, it's not for indicating to the maintainers that you contributed to the solution and/or posted a patch. Then, when you've finished your work it's customary to set the field back to "unassigned" so that others can then do some additional work as necessary. Thank you.

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.

longwave’s picture

Project: Drupal core » Seven
Version: 9.5.x-dev » 1.0.0-alpha1
Component: Seven theme » Code

The Seven theme has been removed from Drupal 10 core. I confirmed that this issue only affects Seven and no other themes included with Drupal core, so I am moving this to the contributed Seven project.

roberttabigue’s picture

Status: Needs review » Needs work
FileSize
2.87 MB

Hi @marcusvsouza,

I can still reproduce the Contrast issue after applying patch #54 to the Seven contrib theme 1.0.0-alpha1 as a Default theme and with Drupal core version of 9.5.6.

Moving this to "Needs work" and please see the attached screenshot for reference.
Thanks.