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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

AvatarGroup and Avatar use unstructured markup #33993

Closed
2 tasks done
paulschreiber opened this issue Aug 19, 2022 · 1 comment 路 Fixed by #33994
Closed
2 tasks done

AvatarGroup and Avatar use unstructured markup #33993

paulschreiber opened this issue Aug 19, 2022 · 1 comment 路 Fixed by #33994
Assignees
Labels
component: avatar This is the name of the generic UI component, not the React module!

Comments

@paulschreiber
Copy link
Contributor

paulschreiber commented Aug 19, 2022

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 馃槸

Currently, AvatarGroup and Avatar generate <div>s for markup, which is not semantic/structured.

<div class="MuiAvatarGroup-root css-1qy80yj-MuiAvatarGroup-root">
  <div class="MuiAvatar-root MuiAvatar-circular MuiAvatarGroup-avatar css-1ltupah-MuiAvatar-root">
    <img alt="" src="https://example.com/example.png" class="MuiAvatar-img css-1pqm26d-MuiAvatar-img">
  </div>
</div>

Expected behavior 馃

Using a list would better structure the list and its members for screen reader users:

<ul class="MuiAvatarGroup-root css-1qy80yj-MuiAvatarGroup-root">
  <li class="MuiAvatar-root MuiAvatar-circular MuiAvatarGroup-avatar css-1ltupah-MuiAvatar-root">
    <img alt="" src="https://example.com/example.png" class="MuiAvatar-img css-1pqm26d-MuiAvatar-img">
  </li>
</ul>

Steps to reproduce 馃暪

import { Avatar, AvatarGroup, } from '@mui/material';

<AvatarGroup total={totalCount}>
  {membersSample.map((member, index) => (
    <Avatar key={index} user={member} />
  ))}
</AvatarGroup>

Context 馃敠

This was flagged during an accessibility review of our application. Other MUI components, such as Typography let you override the HTML component (i.e. component="h2"), but AvatarGroup does not.

It would be good to (a) use <ul> and <li> as the defaults and (b) allow overriding of the component when needed.

Your environment 馃寧

npx @mui/envinfo
  System:
    OS: macOS 12.5.1
  Binaries:
    Node: 18.7.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.15.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 104.0.5112.101
    Edge: Not Found
    Firefox: 101.0
    Safari: 15.6.1
  npmPackages:
    @emotion/react: ^11.9.3 => 11.9.3 
    @emotion/styled: ^11.9.3 => 11.9.3 
    @mui/base:  5.0.0-alpha.91 
    @mui/icons-material: ^5.8.4 => 5.8.4 
    @mui/lab: ^5.0.0-alpha.92 => 5.0.0-alpha.92 
    @mui/material: ^5.9.2 => 5.9.2 
    @mui/private-theming:  5.9.1 
    @mui/styled-engine:  5.8.7 
    @mui/system:  5.9.2 
    @mui/types:  7.1.5 
    @mui/utils:  5.9.1 
    @mui/x-data-grid: ^5.7.0 => 5.7.0 
    @types/react:  17.0.40 
    react: ^17.0.2 => 17.0.2 
    react-dom: ^17.0.2 => 17.0.2 
    typescript:  4.7.4 
@paulschreiber paulschreiber added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 19, 2022
@michaldudak michaldudak added the component: avatar This is the name of the generic UI component, not the React module! label Aug 22, 2022
@siriwatknp
Copy link
Member

siriwatknp commented Aug 23, 2022

This issue is related to default accessibility (the markup) of the Avatar, AvatarGroup. Another issue is the workaround via component that is not working in AvatarGroup which should be a separate issue. Let's separate them:

The markup benchmark

Let's wait for 馃憤 and consider adding it in v6.

For the workaround problem, I will create another issue.

@siriwatknp siriwatknp added this to the v6 milestone Aug 23, 2022
@michaldudak michaldudak removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: avatar This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants