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

High-Contrast Mode #62

Open
tigt opened this issue Sep 13, 2019 · 1 comment
Open

High-Contrast Mode #62

tigt opened this issue Sep 13, 2019 · 1 comment

Comments

@tigt
Copy link

tigt commented Sep 13, 2019

While styles for Windows High-Contrast Mode are currently behind -ms- prefixes, that’s worth overlooking to better serve HCM users.

Browser support/considerations

Proposed global HCM styles

At work, testing HCM revealed some styles worth applying globally, presumably oversights in IE/Edge:

@media (-ms-high-contrast: active) {
  *, ::before, ::after {
    border-image: none !important; /* falls back to border-style */
    list-style-image: none !important; /* falls back to list-style-type */
  }
}

There’s also arguments for resetting properties like filter and mix-blend-mode, but those are harder to reason about. IE/old Edge don’t support them on HTML content except in corner cases like <foreignObject> — but Edgium will.

Newer HTML5 elements could use assigned HCM colors, as some permutations of Windows, IE/Edge version, and HTML5 features can lead to visibility problems:

  • <mark> in Windows 8 seems to have its color still be #000, requiring color: inherit or similar

  • Beyond that bug, <mark> doesn’t render usefully in HCM, as its recommended styling is mostly background-color. An indicator can be restored in IE, Edge, and Firefox with:

    mark {
      box-sizing: border-box;
      border: 1px dotted transparent;
    }

    This renders nothing normally — but when HCM forces border-color: currentColor, it shows.

  • Newer form-associated elements sometimes need attention: <meter>, <input type="range">, and <progress>, off the top of my head.

@fuzzbomb
Copy link

fuzzbomb commented Apr 9, 2020

mark {
  box-sizing: border-box;
  border: 1px dotted transparent;
}

This is VERY likely to be confused with the default focus style in Firefox + IE, which is a 1px dotted outline.

Moreover, a 1px dotted transparent outline (or border) is a commonly-used fallback method to provide a focus style in HCM, in designs which use a box-shadow as a focus style in the full-colour space. The box-shadow is stripped out in HCM, but the transparent outline becomes visible in HCM. I wrote about the approach at CSS box-shadow vs outline.

I recommend we avoid using this approach for <mark>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants