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

[docs][material-ui][Dialog] Improve screen reader announcement of Customized Dialog #38592

Conversation

ZeeshanTamboli
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli commented Aug 22, 2023

Closes #37670.

When the <button> is placed outside the dialog title (h2), it announces correctly. While it's not flawless, it avoids saying "Modal title close dialog" and "close button heading level 2" Instead, it now says "Modal title Dialog," and when tabbed to the close button, it announces "Close button" (Confirmed on NVDA version 2023.1).

I also removed an unnecessary conditional operator regarding the onClose handler to show the close icon button.

Before: https://mui.com/material-ui/react-dialog/#customization
After: https://deploy-preview-38592--material-ui.netlify.app/material-ui/react-dialog/#customization

@ZeeshanTamboli ZeeshanTamboli added docs Improvements or additions to the documentation accessibility a11y component: dialog This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material labels Aug 22, 2023
@ZeeshanTamboli ZeeshanTamboli changed the title [docs][material-ui][Dialog] Fix screen reader announcing close button of dialog multiple times [docs][material-ui][Dialog] Improve screen reader announcement of Customized Dialog Aug 22, 2023
@mui-bot
Copy link

mui-bot commented Aug 22, 2023

Netlify deploy preview

https://deploy-preview-38592--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 4097d99

@ZeeshanTamboli ZeeshanTamboli marked this pull request as ready for review August 22, 2023 05:58
Copy link
Member

@DiegoAndai DiegoAndai left a comment

Choose a reason for hiding this comment

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

I agree with this change. I'm curious if DialogTitle is confusing for users. DialogTitle may be understood as this whole section:

Screenshot 2023-08-22 at 12 15 06

In which case users may think it's expected for the close button to go inside it, leading to errors like the one this PR fixes. Maybe we could add documentation addressing this?

@siriwatknp siriwatknp merged commit c82b968 into mui:master Aug 23, 2023
@ZeeshanTamboli ZeeshanTamboli deleted the issue-37670-screen-reader-close-button-for-dialog branch August 23, 2023 06:53
@ZeeshanTamboli
Copy link
Member Author

ZeeshanTamboli commented Aug 23, 2023

users may think it's expected for the close button to go inside it, leading to errors like the one this PR fixes. Maybe we could add documentation addressing this?

Perhaps this demo fix is enough for the documentation, showing the button now being placed outside the heading?

@Nomulacharitha
Copy link

Nomulacharitha commented Sep 8, 2023

Hello @ZeeshanTamboli,
After the fix it is reading as:
Modal title close button
Modal title button close
Can't we make it read only 1 time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y component: dialog This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[docs][material-ui][Dialog] Screen Readers are reading close button of Dialog for multiple times
5 participants