Skip to content

[docs] Update menu examples to always have aria-expanded#48211

Open
silviuaavram wants to merge 1 commit intomui:masterfrom
silviuaavram:docs/menu-aria-expanded
Open

[docs] Update menu examples to always have aria-expanded#48211
silviuaavram wants to merge 1 commit intomui:masterfrom
silviuaavram:docs/menu-aria-expanded

Conversation

@silviuaavram
Copy link
Copy Markdown
Member

@silviuaavram silviuaavram commented Apr 6, 2026

Partial improvement for #34074. The menu button will be announced as collapsed. We are also aligning with the a11y pattern and BaseUI.

@silviuaavram silviuaavram self-assigned this Apr 6, 2026
@silviuaavram silviuaavram added docs Improvements or additions to the documentation. accessibility a11y scope: menu Changes related to the menu. labels Apr 6, 2026
Copilot AI review requested due to automatic review settings April 6, 2026 14:35
@silviuaavram silviuaavram added v7.x needs cherry-pick The PR should be cherry-picked to master after merge. labels Apr 6, 2026
@mui-bot
Copy link
Copy Markdown

mui-bot commented Apr 6, 2026

Netlify deploy preview

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

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 10410d4

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Material UI docs menu examples to ensure aria-expanded is always present on menu trigger elements, improving screen reader announcement behavior (aligning with common a11y patterns and addressing issue #34074).

Changes:

  • Replace conditional aria-expanded={open ? 'true' : undefined} with aria-expanded={open} across affected menu examples.
  • Apply the same adjustment consistently to both TSX and JS variants of each example.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
docs/data/material/components/menus/AccountMenu.tsx Always render aria-expanded using the boolean open state.
docs/data/material/components/menus/AccountMenu.js Same change as TSX example for parity.
docs/data/material/components/menus/BasicMenu.tsx Always render aria-expanded using the boolean open state.
docs/data/material/components/menus/BasicMenu.js Same change as TSX example for parity.
docs/data/material/components/menus/CustomizedMenus.tsx Always render aria-expanded using the boolean open state.
docs/data/material/components/menus/CustomizedMenus.js Same change as TSX example for parity.
docs/data/material/components/menus/FadeMenu.tsx Always render aria-expanded using the boolean open state.
docs/data/material/components/menus/FadeMenu.js Same change as TSX example for parity.
docs/data/material/components/menus/GroupedMenu.tsx Always render aria-expanded using the boolean open state.
docs/data/material/components/menus/GroupedMenu.js Same change as TSX example for parity.
docs/data/material/components/menus/LongMenu.tsx Always render aria-expanded using the boolean open state.
docs/data/material/components/menus/LongMenu.js Same change as TSX example for parity.
docs/data/material/components/menus/MenuListComposition.tsx Always render aria-expanded using the boolean open state.
docs/data/material/components/menus/MenuListComposition.js Same change as TSX example for parity.
docs/data/material/components/menus/PositionedMenu.tsx Always render aria-expanded using the boolean open state.
docs/data/material/components/menus/PositionedMenu.js Same change as TSX example for parity.
docs/data/material/components/menus/SimpleListMenu.tsx Always render aria-expanded using the boolean open state.
docs/data/material/components/menus/SimpleListMenu.js Same change as TSX example for parity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility a11y docs Improvements or additions to the documentation. needs cherry-pick The PR should be cherry-picked to master after merge. scope: menu Changes related to the menu. v7.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants