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

Switch component is not visible in high contrast mode #43479

Open
dominoweir opened this issue Aug 27, 2024 · 6 comments
Open

Switch component is not visible in high contrast mode #43479

dominoweir opened this issue Aug 27, 2024 · 6 comments
Assignees
Labels
accessibility a11y design This is about UI or UX design, please involve a designer

Comments

@dominoweir
Copy link

dominoweir commented Aug 27, 2024

Steps to reproduce

Link to live example: (required)

Every single switch on https://mui.com/material-ui/react-switch/

Steps:

  1. Visit the link above in a chrome browser
  2. In chrome dev tools, open the "rendering" tab in the console drawer and scroll down to Emulate CSS media feature forced-colors. Set it to forced-colors: active
  3. Note that the switches are not visible in any demo on the docs page.

image

Current behavior

Switches are not visible, although the pointer cursor does show when you hover on them

Expected behavior

Switches should be visible when forced colors mode is turned on

Context

Trying to fix some accessibility issues in high contrast mode and although I might be able to override the styles on my own, it would be better for this to work out of the box.

Your environment

Please note that although I'm using v5 right now, this issue is reproducible on mui.com using the latest version option available.

npx @mui/envinfo
    System:
    OS: Linux 6.7 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
  Binaries:
    Node: 20.16.0 - /usr/local/bin/node
    npm: 10.8.1 - /usr/local/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: 128.0.6613.84
  npmPackages:
    @emotion/react: ^11.13.0 => 11.13.0 
    @emotion/styled: ^11.13.0 => 11.13.0 
    @mui/base:  5.0.0-beta.31 
    @mui/core-downloads-tracker:  5.15.4 
    @mui/icons-material: ^5.15.4 => 5.15.4 
    @mui/material: ^5.15.4 => 5.15.4 
    @mui/private-theming:  5.15.4 
    @mui/styled-engine:  5.15.4 
    @mui/styled-engine-sc: ^5.11.11 => 5.11.11 
    @mui/system:  5.15.4 
    @mui/types:  7.2.13 
    @mui/utils:  5.15.4 
    @mui/x-data-grid:  6.18.7 
    @mui/x-data-grid-pro: ^6.18.7 => 6.18.7 
    @mui/x-date-pickers:  6.19.0 
    @mui/x-date-pickers-pro: ^6.19.0 => 6.19.0 
    @mui/x-license-pro: ^6.10.2 => 6.10.2 
    @types/react: ^18.3.1 => 18.3.3 
    react: ^18.3.1 => 18.3.1 
    react-dom: ^18.3.1 => 18.3.1 
    styled-components: ^6.1.12 => 6.1.12 
    typescript: ^5.5.3 => 5.5.3 

Search keywords: forced-color, forced color

@dominoweir dominoweir added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 27, 2024
@dominoweir
Copy link
Author

For anyone who might be looking for a workaround, I had a hard time overriding background colors so instead I added border colors to both the knob and track for the switch:

image

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 27, 2024

I haven't seen a lot of high-contrast issue reports through the years, I'm actually surprised.

Recently, I had a fun time reading https://polypane.app/blog/forced-colors-explained-a-practical-guide/.

@siriwatknp siriwatknp added v7.x design This is about UI or UX design, please involve a designer and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 28, 2024
@siriwatknp
Copy link
Member

Mark this to consider in v7. This is a use case where a default transparent border is helpful.

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 28, 2024

Interesting data from the link above https://polypane.app/blog/forced-colors-explained-a-practical-guide/:

In terms of numbers, Microsoft states that 4% of Windows users use High Contrast mode. In the WebAIM low vision survey, 50% of low vision users indicate they used the mode but of course, that is likely a very self-selecting group of savvy users.

but it can also be a lot of work: https://youtu.be/XYjH_oQ3llg?si=Zcsnb4LBMY7dDjEG&t=792. So to balance the priorities, I could see this fixed by the community.

@dominoweir
Copy link
Author

dominoweir commented Aug 28, 2024

Assuming you're okay with the simple fix of adding a border on the track and knob, that's something I could potentially do-
@oliviertassinari any docs out there on how to make community contributions?

@DiegoAndai
Copy link
Member

@dominoweir here's our contributing guide: https://github.com/mui/material-ui/blob/master/CONTRIBUTING.md

If you open a PR, please add myself and @zanivan as reviewers 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y design This is about UI or UX design, please involve a designer
Projects
None yet
Development

No branches or pull requests

4 participants