-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[material-ui][Switch] Failing on color contrast checks #39134
Comments
Hi, is this issue being work on ?? |
We'd have to modify the styles in the component itself as we don't want to add additional styles to Material UI demos @danilo-leal Is that ok (not really a breaking change?) if the adjustments are small? |
@juperameza Thanks for your interest, let's wait for Danilo to confirm how to do this one first ~
BTW it may not be necessary to find middle ground, it's ok to use different values for each color mode if overall it's better, e.g. here 😬 |
Hey there! Allow me to chime in for a bit 😉
IMO, as long as we keep using the current Material UI tokens or styles for tiny adjustments, it shouldn’t be a breaking change. About the issue, though, I wonder if this is really necessary. By the WCAG guidelines, the visual of components should have an AA contrast ratio, it means at least 3:1 against adjacent colors. However, in this component we don't rely only on color to distinguish the states, since the thumb surpasses the track, and we also have a box-shadow and some micro interactions. That said, I think the default switch has room for improvement. Maybe working on the box-shadow a bit, so it would present a slight contour on the whole thumb? Regardless, I'm open for suggestions and tiny improvements @juperameza |
👋🏼 Can you expand a little?
From a WCAG POV, I would imagine this does fail, the colours do not have enough contrast. Within Chrome, you can emulate vision deficiencies to give a clearer insight to what a user might experience. You'll notice if you emulate "reduce contrast", it becomes very hard to see. Should contrast checks pass this would improve. Users with retinal disorders such as age-related macular degeneration (ARMD), amblyopia, lens abnormalities, such as cataract might experience the switch in this way. Also if you remove colour, the switch state is a little unclear. Which switch is on or off? Which switch is disabled? Ideally darkening the colours until they pass AA is really quick fix to improve accessibility. |
Nice points @chris-gds, and it indeed makes a lot of sense. However, to achieve this level of contrast, I believe it would be a breaking change, since we would have to increase and change colors too much—besides, it'd be very distant from MD default. |
Duplicates
Latest version
Steps to reproduce 🕹
Link to live example:
https://mui.com/material-ui/react-switch/
Steps:
Current behavior 😯
All of the switches fail colour contrast checks in some way.
Expected behavior 🤔
I would expect all of the switch Designs to pass colour contrast AA checks.
Context 🔦
Users that blind or visually impaired impacted - switches do not have the correct contrast.
Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: