-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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] Fix a11y in Menu demos #30378
[docs] Fix a11y in Menu demos #30378
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The a11y of this demo https://deploy-preview-30378--material-ui.netlify.app/components/menus/#account-menu seems wrong too.
aria-controls
in Basic Menu
demo. aria-controls
in menu demo
aria-controls
in menu demo
I improved a11y in the Menu demos which had low score and the score of each of them got better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 👍
@@ -17,7 +17,7 @@ export default function BasicMenu() { | |||
<div> | |||
<Button | |||
id="basic-button" | |||
aria-controls="basic-menu" | |||
aria-controls={open ? 'basic-menu' : undefined} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks correct based on https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls
A combobox element has aria-controls set to a value that refers to the element that serves as the popup. The aria-controls only needs to be set when the popup is visible, but it is valid and easier to program to reference an element that is not visible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that in our case, it's even more than non-visible => non-existent.
On a different note, the thread in w3c/aria#995 (comment) suggests that the attribute is close to poop.
@ZeeshanTamboli Great, well done, thanks! |
Thank you for submitting this 🙏🏼 |
Closes #30125
Improves the Lighthouse accessibility score from 84 to 94 of this demo.
https://deploy-preview-30378--material-ui.netlify.app/components/menus/