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

[material-ui][Alert] Potential accessibility issues #40198

Open
garyb1 opened this issue Dec 13, 2023 · 1 comment
Open

[material-ui][Alert] Potential accessibility issues #40198

garyb1 opened this issue Dec 13, 2023 · 1 comment
Assignees
Labels
accessibility a11y component: alert This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: material-ui Specific to @mui/material waiting for 👍 Waiting for upvotes

Comments

@garyb1
Copy link

garyb1 commented Dec 13, 2023

Hi,
I was looking at the Alert component and I noticed it added an ARIA alert role to the component. This component may potentially not exist on page load and might be displayed dynamically.

In your accessibility notes for the alert component you say:

When the component is dynamically displayed, the content is automatically announced by most screen readers. At this time, screen readers do not inform users of alerts that are present when the page loads.

The content is not always automatically announced by some screen readers though. Scott O'Hara talks about this in a post called are we live.

Dynamically injecting a live region node or changing an existing live region from display: none to display: block are effectively the same. In both cases (being absent or set to display: none) the live region does not exist in the a11y tree. Rather, as the following test cases show, ensuring an empty live region exists in your DOM, and injecting content into it when necessary, proves to be the most robust way to ensure a live region will be announced.

Severity of Alerts

Some people might not consider a success message an alert, and depending on context, info and warning might not be either. You are appending role="alert" to the component for all variants. I really think this should be revisited. At the very least mentioned in the documentation. I don't think pointing to the WAI-ARIA Authoring Practices helps here.

Thanks.

@github-actions github-actions bot added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 13, 2023
@danilo-leal danilo-leal changed the title [Alert Component] - Potential Accessibility Issues with MUI Alert [material-ui][Alert] Potential accessibility issues Dec 13, 2023
@danilo-leal danilo-leal added accessibility a11y package: material-ui Specific to @mui/material component: alert This is the name of the generic UI component, not the React module! labels Dec 13, 2023
@DiegoAndai DiegoAndai self-assigned this Dec 13, 2023
@DiegoAndai DiegoAndai added this to the Material UI: v7 draft milestone Dec 13, 2023
@DiegoAndai DiegoAndai added 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 Dec 13, 2023
@DiegoAndai
Copy link
Member

Hey @garyb1, thanks for the report!

This audit of the Alert component is very helpful. I hope we get to improve this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y component: alert This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: material-ui Specific to @mui/material waiting for 👍 Waiting for upvotes
Projects
None yet
Development

No branches or pull requests

4 participants