Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix display of warning text in Edge when Windows High Contrast Mode is enabled #2186

Merged
merged 2 commits into from
Apr 14, 2021

Conversation

36degrees
Copy link
Contributor

When Windows High Contrast Mode (HCM) is enabled for Edge, the warning text icon is affected by the readability backplate which draws a box around the exclamation mark, obscuring parts of the circle.

Opt out of the readability backplate by setting forced-color:adjust: none and handle it ourselves, by overriding the colors to system colours in a media query which detects if forced colors are active.

Use forced-color-adjust and forced-colors over the MS specific -ms-high-contrast-adjust: none; and -ms-high-contrast: active to allow for future support from other browsers (e.g. Firefox, which allows users to set their own colour scheme for pages).

HCM with IE11 does not seem to be affected by the same issue – I don’t think it implements a readability backplate.

Theme Before After
High Contrast Black Screenshot 2021-04-13 at 09 12 00 Screenshot 2021-04-13 at 09 12 04
High Contrast White Screenshot 2021-04-13 at 09 12 12 Screenshot 2021-04-13 at 09 12 17
High Contrast # 1 Screenshot 2021-04-13 at 09 12 26 Screenshot 2021-04-13 at 09 12 30
High Contrast # 2 Screenshot 2021-04-13 at 09 12 40 Screenshot 2021-04-13 at 09 12 43

When Windows High Contrast Mode (HCM) is enabled for Edge, the warning text icon is affected by the readability backplate [1] which draws a box around the exclamation mark, obscuring parts of the circle.

Opt out of the readability backplate by setting `forced-color:adjust: none` and handle it ourselves, by overriding the colors to system colours in a media query which detects if forced colors are active.

Use `forced-color-adjust` and `forced-colors` over the MS specific `-ms-high-contrast-adjust: none;` and `-ms-high-contrast: active` to allow for future support from other browsers (e.g. Firefox, which allows users to set their own colour scheme for pages).

HCM with IE11 does not seem to be affected by the same issue – I don’t think it implements a readability backplate.

[1]: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/6208eaffa0362ca107644c99b902c0b06bd5a0c8/Accessibility/HighContrast/explainer.md#ensuring-readability
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2186 April 13, 2021 08:39 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2186 April 13, 2021 08:40 Inactive
@36degrees
Copy link
Contributor Author

We have the same issue in Firefox, which this unfortunately doesn't fix, because Firefox doesn't support the forced-color-adjust property (and doesn't have any other prefixed, non-standard or similar property we could use instead).

Copy link
Contributor

@vanitabarrett vanitabarrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍 Is it worth expanding the Changelog entry, at the moment it sounds like it fixes the error in all browsers?

@36degrees 36degrees changed the title Fix display of warning text in High Contrast Mode Fix display of warning text in Edge when Windows High Contrast Mode is enabled Apr 14, 2021
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2186 April 14, 2021 11:01 Inactive
@36degrees 36degrees merged commit ffe72e5 into master Apr 14, 2021
@36degrees 36degrees deleted the warning-text-hcm branch April 14, 2021 11:59
@36degrees 36degrees added this to the v3.12.0 milestone Apr 14, 2021
@36degrees 36degrees mentioned this pull request May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants