question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Windows High Contrast Mode / forced color adaptations

See original GitHub issue

Proposal

Adding a few surgical, very specific general styles to Bootstrap using the (forced-colors) media query, to make sure that some of our components that aren’t properly discernible in Windows High Contrast Mode stand a slightly better chance at having at least minimal styles applied even in WHCM.

Motivation and context

Splitting the idea out of https://github.com/twbs/bootstrap/pull/29490

A lot of the standard Bootstrap styles rely on background colours, borders and shadows (e.g. to make buttons/pills/etc look “button-like”). These styles usually get completely overridden by Windows High Contrast Mode (WHCM), which explicitly ignores things like background and forces specific user-defined colours for things.

Until recently, there was no clean standardised way of approaching this issue (even with proprietary things like -ms-high-contrast - see https://www.tpgi.com/windows-high-contrast-mode-the-limited-utility-of-ms-high-contrast/)

However, the relatively new (forced-colors) media query offers a relatively stable way of approaching this issue now, adding very targeted adaptations/tweaks for cases where WHCM is enabled.

I have recently been playing with it on a project (not directly using Bootstrap, but the concept is obviously the same) to force an outline (rather than a border, so it doesn’t affect element dimensions), a la

@media (forced-colors) {
  button {
    outline: 1px solid LinkText !important;
  }
}

Trying to do further/more intense styling is probably counterproductive (i.e. not doing a whole exercise like dark mode or anything), but just some basics like this would immediately make BS more WHCM-friendly for very little extra effort.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
patrickhlaukecommented, Jul 29, 2022

Taking https://getbootstrap.com/docs/5.2/examples/cheatsheet/ for a quick spin in high contrast (Windows 10 WHCM, Chrome):

Forms

Overview

  • checked checkbox, selected radio button, shows no focus indication image

  • switch checkbox input: when not checked, only shows outline border; when focused, shows faint off switch; when checked, has no focus indicator image image image

  • example range totally invisible image

Floating labels

  • floating label doesn’t hide placeholder text; when focused, shows awkward focus outline image

Validation

  • “Agree…” checkbox shows no focus indication image

Components

  • Accordion shows no focus indication

image

Alerts

  • No visible X close control, no focus indication for it image

Badge

  • Shows no outline/border image

Carousel

  • Dots look awkward/wrong image

Dropdowns

  • Down arrow looks wrong
  • Focus indication on active dropdown item not shown image

Modal

  • No visible X close control, no focus indication for it image

Navs

  • doesn’t show active one image

Navbar

  • First example, logo doesn’t show image

Pagination

  • Current active one not shown image

Popovers

  • Arrow looks awkward/wrong image

Progress

  • Bar is totally invisible image

Spinners

  • Completely static circles image

Toasts

  • No visible X close control, no focus indication for it image

Tooltips

  • Arrow looks awkward/wrong image

Other

A few other examples not covered in the cheatsheet:

2reactions
davidscotsoncommented, Jun 17, 2022

I’ve started a gist here, I’ll try to remember to update it as I test and find issues:

https://gist.github.com/davidscotson/446f5a637715af9d1db832f60640e705

Read more comments on GitHub >

github_iconTop Results From Across the Web

Styling for Windows high contrast with new standards for ...
For example, browsers can apply high contrast theme colors ... First, we will detect a forced color mode using the forced-colors media query ......
Read more >
Windows High Contrast Mode, Forced Colors Mode And CSS ...
For some, Windows High Contrast/Forced Colors mode represents the last option they have to view content on their device — including web content....
Read more >
Make core themes more robust in Windows High-Contrast mode
The main effects of Windows High Contrast mode on browser content are as ... Colour adaptation: Android has a setting to tweak colours...
Read more >
Windows High contrast mode | Microsoft Learn
forced -colors works with Windows high contrast mode in Windows, located in Ease of Access within Settings. There are two default themes to...
Read more >
Web Design References: Color and Contrast
Andrew Somers; Why Your Mac Color Contrast Testing Might Be All Wrong - Rodrigo Sanchez; Windows High Contrast Mode and Accessibility Testing -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found