Problem/Motivation

I found a serious misuse of colour in a high-contrast media query.

The pagination indicates the current page by drawing a circle around the number. In the full-colour scheme, a blue background is used for this link. When using a Windows high-contrast mode, this background colour is stripped away, so pager.pcss.css uses an -ms-high-contrast: active media query, to set an explicit WHITE border around the active item in the pager.

This isn't guaranteed to show up against the page background.

Steps to reproduce

When designing for Windows high-contrast (a.k.a. forced colours), remember to test with arbitrary user-specified colour schemes, as well as the pre-set ones.

When using one of the pre-set colour schemes with a black background, the white border shows up well:
Current page indicated by a white border, against a black page background. Good contrast.

However, when using the pre-set black-on-white colour scheme, the white border cannot be seen at all, because it's the same as the page background:

The current page isn't indicated. The white border is invisible against the white page background.

When a custom colour scheme has been chosen by the user, anything could happen. Sometimes you get lucky; here I'm using a custom yellow-on-blue scheme. The white border shows up well against the blue background:

The current page is indicated by a white border, against a dark blue background.

Other times, you aren't so lucky. Here's a brown-on-peach scheme. The explicit white border doesn't show up very well.

A white border is hard to see against a light peach page background.

I think I saw another instance of an explicit colour inside a high-contrast media query.

Proposed resolution

Remove this explicit white colour. Let it use a border the same colour as the link text.

Remaining tasks

Look for other instances of explicit colours in an -ms-high-contrast media query.

User interface changes

When multiple characters are used within a pager item (eg double numbers), the circle outline can stretch into an oval. This is per the design, but was less pronounced with the white border.

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#17 edge_pager_links_whcm_high_contrast_white.png60.94 KBm4olivei
#17 edge_pager_links_whcm_high_contrast_black.png54.32 KBm4olivei
#17 chrome_pager_links_whcm_high_contrast_black.png56.24 KBm4olivei
#17 chrome_pager_links_whcm_high_contrast_white.png61.7 KBm4olivei
#17 chrome_pager_links_normal.png98.97 KBm4olivei
#14 elongated-circle-pager.gif1.16 MBmherchel
#12 Screen Shot 2021-08-10 at 17.42.44.png2.39 KBlauriii
#12 Screen Shot 2021-08-10 at 17.42.36.png2.36 KBlauriii
#11 ie-no-patch.png231.21 KBmherchel
#11 edge with patch.png196.34 KBmherchel
#11 edge-no-patch.png231.75 KBmherchel
#11 ff-with-patch.png199.43 KBmherchel
#11 ff- no patch.png204.73 KBmherchel
#11 ie -with patch.png212.86 KBmherchel
#11 ie-no-patch.png231.21 KBmherchel
#7 3194669-7.patch1.21 KBandrewmacpherson
#7 interdiff-3194669-6-7.txt946 bytesandrewmacpherson
#6 interdiff-3194669-3-6.txt1.03 KBandrewmacpherson
#6 3194669-6.patch1.19 KBandrewmacpherson
#3 3194669-3-after-patch-high-contrast-custom-scheme-brown-on-peach.png154.52 KBandrewmacpherson
#3 3194669-3-after-patch-high-contrast-custom-scheme-yellow-on-blue.png164.97 KBandrewmacpherson
#3 3194669-3-after-patch-high-contrast-preset-scheme-white.png156.3 KBandrewmacpherson
#3 3194669-3-after-patch-high-contrast-preset-scheme-1.png148.67 KBandrewmacpherson
#3 3194669-3.patch1.27 KBandrewmacpherson
#2 3194669-2-claro-pager-is-active-white-border-windows-high-contrast_custom-scheme-brown-on-peach.png79.9 KBandrewmacpherson
#2 3194669-2-claro-pager-is-active-white-border-windows-high-contrast_custom-scheme-yellow-on-blue.png85.47 KBandrewmacpherson
#2 3194669-2-claro-pager-is-active-white-border-windows-high-contrast_preset-scheme-white-bg.png79.57 KBandrewmacpherson
#2 3194669-2-claro-pager-is-active-white-border-windows-high-contrast_preset-scheme-1.png79.16 KBandrewmacpherson
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andrewmacpherson created an issue. See original summary.

andrewmacpherson’s picture

Title: Misuse of explicit colour in -ms-high-contrast media query » Misuse of explicit colour for active pager item in -ms-high-contrast media query
Issue summary: View changes
Status: Active » Needs review
FileSize
1.27 KB
148.67 KB
156.3 KB
164.97 KB
154.52 KB

This can work easily without using any overrides in a -ms-high-contrast. Often, you don't need to detect when high-contrast mode is actually being used, just anticipate it.

The patch here removes the border property from the high-contrast media query, and instead puts a transparent border in the main styles for the full-colour space. When a Windows high-contrast theme is used, the background colour is removed, and the border colour is overridden to whatever the high-contrast theme is using for links.

By avoiding the MS vendor media query, this works correctly in Firefox and Blink too.

Manual testing results:

In these screenshots, we see 4 browser windows. Clockwise from top-left, they are:

  • IE11
  • Edge 18
  • Firefox 84
  • Chrome 88 (with the forced-colors experimental flag enabled)

Using the "High contrast #1" preset colour scheme, with a black background:

Pager screenshot in high-contrast mode, with a black background

Using the preset black-on-white scheme:

Pager screenshot in high-contrast mode, with a white background

Using my custom yellow-on-blue scheme:

Pager screenshot in high-contrast mode, with a blue background

Using my custom brown-on-peach scheme:

Pager screenshot in high-contrast mode, with a peach background. The

In all these scenarios, the current page is indicated by a circular border. It follows whatever the high-contrast theme uses as a link colour (including the visited-link colour).

andrewmacpherson’s picture

Triage: I gave this major priority, because it relates WCAG SC 1.4.1 Use of Color at level-A. It also relates to SC 1.4.11 Non-text Contrast at level-AA, and SC 2.4.8 Location at level-AAA.

andrewmacpherson’s picture

andrewmacpherson’s picture

Patch #3 failed automated lint checks.

No change to properties here, just re-ordering.

andrewmacpherson’s picture

FileSize
946 bytes
1.21 KB

Okay third time lucky with the magic test bot dance. On Slack, @longwave kindly directed me to the stylelintrc file. I'm bemused by the order, but at least I have my instructions now.

No change to properties here, just re-ordering.

mgifford’s picture

Issue tags: +wcag131, +ms-high-contrast
mgifford’s picture

Issue tags: -ms-high-contrast +high contrast

correcting tagging

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.

mherchel’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
231.21 KB
212.86 KB
204.73 KB
199.43 KB
231.75 KB
196.34 KB
231.21 KB

This looks good to me! Patch still applies, and tested this out on Edge, FF, and IE.

Screenshots:

FF - No patch

FF with patch

IE - No patch

IE with patch

Edge - no patch (note this works properly without patch)

Edge - with patch.

lauriii’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs issue summary update
FileSize
2.36 KB
2.39 KB

This does slightly change the design of current pager item for pages 10 or higher. This should be added in the issue summary, and we should confirm with one of the designers if this is acceptable.

Before:

After:

mherchel’s picture

Status: Needs review » Needs work

Bleh. Yeah, that's definitely not per the design. I'll work on this.

mherchel’s picture

Status: Needs work » Needs review
FileSize
1.16 MB

Scratch that! That is per the design.

The highlight turns into an elongated oval. See attached image for reference.

mherchel’s picture

Lauriii's comment in Slack

@mherchel I think you are probably right on that - the old behavior was probably incorrect. I think we still should update the issue summary with the UI changes and after that it can probably be moved back to RTBC

mherchel’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs issue summary update

Updated issue summary, and setting back to RTBC per @lauriii's slack comment.

m4olivei’s picture

+1, RTBC from me as well! Here are some screenshots of patch from #7 which is still applying against 9.3.x:

Chrome, Normal Mode:

Chrome WHCM Black:

Chrome WHCM White:

Edge WHCM Black:

Edge WHCM White:

  • lauriii committed 98a6e3e on 9.3.x
    Issue #3194669 by andrewmacpherson, mherchel, m4olivei, lauriii,...

  • lauriii committed 6084fc5 on 9.2.x
    Issue #3194669 by andrewmacpherson, mherchel, m4olivei, lauriii,...
lauriii’s picture

Version: 9.3.x-dev » 9.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed 98a6e3e and pushed to 9.3.x. Also cherry-picked to 9.2.x because Claro is experimental. Thanks!

Status: Fixed » Closed (fixed)

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