Skip to content

[Rating] Use different shape for empty and filled icons#22554

Merged
oliviertassinari merged 3 commits intomui:nextfrom
oliviertassinari:rating-color-contrast
Sep 11, 2020
Merged

[Rating] Use different shape for empty and filled icons#22554
oliviertassinari merged 3 commits intomui:nextfrom
oliviertassinari:rating-color-contrast

Conversation

@oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Sep 10, 2020

Breaking changes

  • [Rating] Change the default empty icon to improve accessibility.
    If you have a custom icon prop but no emptyIcon prop, you can restore the previous behavior with:

    <Rating
      icon={customIcon}
    + emptyIcon={null}
    />

This is a continuation of #22541 by @eps1lon. The success Criterion 1.4.1 of WCAG 2.1. mentions the following:

This success criterion addresses color perception specifically. Color is not used as the only visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element.

The rationale is explained in https://www.w3.org/WAI/WCAG21/Understanding/use-of-color.html. Users with partial sight often experience limited color vision. It can even be as extreme as only seeing in the greyscale.

As it turns out, if you are color blind, you can't see the active value with the current implementation. It sucks:

Capture d’écran 2020-09-10 à 20 41 37

value = 2


The proposed solution is based on #22541 (comment) and relies on:

  • Using a different shape between the filled and empty state.
  • Increase the color contrast (when RGB blind) slightly between the filled and empty states.
  • Encourage to duplicate the information with text in the a11y section.
  • Update the customization demos to be as good as possible, e.g. use opacity Capture d’écran 2020-09-10 à 20 53 56

After the changes applied, the component look as follow in the different color distortions:

  • Achromatopsia (RGB-blind)

Capture d’écran 2020-09-10 à 20 46 35

  • Achromatomaly (RGB-weak)

Capture d’écran 2020-09-10 à 20 46 47

  • Tritanopia (blue-blind)

Capture d’écran 2020-09-10 à 20 46 52

  • Tritanomaly (blue-weak)

Capture d’écran 2020-09-10 à 20 46 56

  • Deuteranopia (green-blind)

Capture d’écran 2020-09-10 à 20 46 59

  • Deuteranomaly (green-week)

Capture d’écran 2020-09-10 à 20 47 02

  • Protanopia (red-blind)

Capture d’écran 2020-09-10 à 20 47 06

  • Protanomaly (red-weak)

Capture d’écran 2020-09-10 à 20 47 10

@oliviertassinari oliviertassinari added accessibility a11y scope: rating Changes related to the rating. labels Sep 10, 2020
@oliviertassinari oliviertassinari changed the title [Rating] Use different shape or empty and filled icons [Rating] Use different shape for empty and filled icons Sep 10, 2020
@mui-pr-bot
Copy link

mui-pr-bot commented Sep 10, 2020

@material-ui/lab: parsed: +0.13% , gzip: +0.18%

Details of bundle changes

Generated by 🚫 dangerJS against 0027def

@oliviertassinari oliviertassinari added the breaking change Introduces changes that are not backward compatible. label Sep 10, 2020
Co-authored-by: Matt <github@nospam.33m.co>
@mbrookes
Copy link
Member

mbrookes commented Sep 10, 2020

Regarding the "Custom empty icon" demo – even though we now mention it in the accessibility section as problematic, perhaps it would be better to combine this with the "Hover feedback" demo, so that a single demo shows a color-only rating, with a text indicator?

Copy link
Member

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad you changed your mind from #22541

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Sep 10, 2020

@eps1lon Thanks for opening an issue on the eBay side and pushing the discussion forward, happy to see they are heading to the same direction eBay/mindpatterns#19 (comment).

@oliviertassinari oliviertassinari merged commit 073d8a5 into mui:next Sep 11, 2020
@oliviertassinari oliviertassinari deleted the rating-color-contrast branch September 11, 2020 08:26
@oliviertassinari
Copy link
Member Author

cc @adrianmanea We will need to update the Figma and Sketch components.

@oliviertassinari oliviertassinari added this to the v5 milestone Sep 15, 2020
@oliviertassinari oliviertassinari mentioned this pull request Sep 15, 2020
42 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility a11y breaking change Introduces changes that are not backward compatible. scope: rating Changes related to the rating.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants