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

AvatarGroup +n icon's default colors do not meet minimum contrast ratio threshold for accessibility #44179

Open
jingdid opened this issue Oct 22, 2024 · 2 comments
Assignees
Labels
accessibility a11y component: avatar This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature

Comments

@jingdid
Copy link

jingdid commented Oct 22, 2024

Steps to reproduce

Link to live example: (required)
Every (+n) avatar on https://mui.com/material-ui/react-avatar/

Steps:

  1. Visit the link above.
  2. Run the axe Devtools chrome extension accessibility scan on that page.
  3. Every (+n) avatar on the page gets flagged as not meeting the contrast ratio (in both light and dark mode, though I have screenshotted light mode for this particular example):
image

Current behavior

Axe devtools highlights all the (+n) avatars, with the message: Element has insufficient color contrast of 1.87 (foreground color: #ffffff, background color: #bdbdbd, font size: 15.0pt (20px), font weight: normal). Expected contrast ratio of 4.5:1

Expected behavior

The default colors on (+n) avatars should have a high enough contrast ratio to pass the accessibility scan.

Context

I am trying to fix accessibility issues on my site, and while I could override the avatar colors on my own, it seems worthwhile to make the default colors pass accessibility tests out of the box.

Your environment

npx @mui/envinfo
  System:
    OS: macOS 12.7.6
  Binaries:
    Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: 130.0.6723.59

This bug is likely system agnostic though since it is a default colors accessibility issue that can be seen on the mui website.

Search keywords: avatargroup default colors accessibility

@jingdid jingdid added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 22, 2024
@zannager zannager added the component: avatar This is the name of the generic UI component, not the React module! label Oct 22, 2024
@siriwatknp
Copy link
Member

For a workaround, you can custom the Avatar background from the theme:

createTheme({
  components: {
    MuiAvatar: {
      styleOverrides: {
        root: {
          variants: [
            { props: { colorDefault: true }, style: { backgroundColor:  } },
          ]
        }
      }
    }
  }
})

@siriwatknp siriwatknp added accessibility a11y enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 13, 2024
@jingdid
Copy link
Author

jingdid commented Nov 13, 2024

Well, yes, per what I wrote in the context section, I could customize it in our theme as a workaround, but given that the default colors are apparently not accessibility friendly, it seems worthwhile for this to also be fixed at a more fundamental level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y component: avatar This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature
Projects
None yet
Development

No branches or pull requests

3 participants