bpmn-io / diagram-js

A toolbox for displaying and modifying diagrams on the web.
MIT License
1.71k stars 418 forks source link

High contrast mode not working with diagram SVG #635

Open robertfoobar opened 2 years ago

robertfoobar commented 2 years ago

Describe the Bug

Visually impaired users, who use e.g. Windows high contrast mode, cannot properly perceive diagram representations in the browser.

Steps to Reproduce

  1. Create a diagram using bpmn.io inside the browser
  2. Activate Windows high contrast mode

Expected Behavior

Colors of the diagrams SVG elements (arrows, outlines of elements, text) should be inverted. They also should respect the user selected high contrast color scheme. Instead what you observe is that the diagram remains in it's default colors.

Default contrast settings: image Expected high contrast look with black high contrast color scheme: image Actual high contrast look with black high contrast color scheme: image

Environment

robertfoobar commented 2 years ago

As a workaround for the black high contrast mode we've added a css media query:

@media (forced-colors: active) {
  g.viewport {
    filter: invert(1);
  }
}

However, for other color schemes, I don't know how this can be worked around. Maybe using currentColor for stroke and fill, see https://melanie-richards.com/blog/currentcolor-svg-hcm/

smbea commented 2 years ago

cc @andreasgeier @currandwyer @christian-konrad

nikku commented 2 years ago

@smbea Let us investigate if this is a quick fix we can adopt, and if so, adopt it.

nikku commented 2 years ago

Marked as a spring cleaning topic.

smbea commented 2 years ago

On Mac, there is a "high-contrast" and "invert colours" mode. With the later, the desired behaviour is achieved:

Screenshot 2022-04-29 at 14 34 19

Keep in mind, this also inverts the color, so the blue fill would become orange, which I believe would be the outcome of what you implemented with forced-colors: active.

Screenshot 2022-04-29 at 14 26 47
smbea commented 2 years ago

I believe we can use your suggestion to make this better for Windows users, so I'm moving this to backlog for now.