Skip to content

[scheduler] add aria-expanded and aria-controls to side panel toggle button - #23402

Merged
rita-codes merged 5 commits into
mui:masterfrom
mustafajw07:fix/21982-scheduler-side-panel-toggle-aria-attrs
Aug 24, 2026
Merged

[scheduler] add aria-expanded and aria-controls to side panel toggle button#23402
rita-codes merged 5 commits into
mui:masterfrom
mustafajw07:fix/21982-scheduler-side-panel-toggle-aria-attrs

Conversation

@mustafajw07

@mustafajw07 mustafajw07 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Closes #21982

@code-infra-dashboard

code-infra-dashboard Bot commented Aug 22, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-23402--material-ui-x.netlify.app/
QR code for https://deploy-preview-23402--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-scheduler 🔺+101B(+0.03%) 🔺+40B(+0.04%)
@mui/x-scheduler-premium 🔺+101B(+0.02%) 🔺+28B(+0.02%)
@mui/x-chat 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@mustafajw07

Copy link
Copy Markdown
Contributor Author

Hey @rita-codes, can you review this pr?

@rita-codes rita-codes added accessibility a11y type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. scope: scheduler Changes related to the scheduler. labels Aug 24, 2026
@rita-codes

rita-codes commented Aug 24, 2026

Copy link
Copy Markdown
Member

Thanks for working on this! The wiring is on the right track — schedulerId and the panel id follow the existing conventions, and since the Collapse keeps the panel mounted, aria-controls always points to a real element. There's one blocking issue with the aria-expanded value, and a couple of smaller notes.

Bugs

🔴 aria-expanded is absent when the side panel is collapsed

Location: packages/x-scheduler/src/event-calendar/header-toolbar/HeaderToolbar.tsx

aria-expanded={isSidePanelOpen ? 'true' : undefined}

This button is a disclosure (the side panel stays mounted inside the Collapse), and the APG Disclosure pattern requires the attribute in both states:

"When the content is visible, the element with role button has aria-expanded set to true. When the content area is hidden, it is set to false."

When the attribute is absent, assistive tech treats it as a regular button with no indication that it expands anything — which is exactly the state this PR is meant to fix. So it should render aria-expanded="false" when the panel is collapsed instead of omitting the attribute. SidePanelDrawer already handles its own disclosure button this way, if you want a reference in the codebase.

Tests

🟡 No test pins the new ARIA contract

Could you add a small test in HeaderToolbar.test.tsx covering the new attributes? Asserting that aria-controls matches the side panel's id and that aria-expanded reflects the open state would keep this contract from silently breaking in a refactor.

Notes

ℹ️ PreferencesMenu / ViewSwitcher — follow-up, out of scope

I know the 'true' : undefined pattern comes from PreferencesMenu/ViewSwitcher (the issue itself points there) — those don't follow the current APG Menu Button pattern either ("When the menu is hidden, aria-expanded is set to false"), but that's pre-existing code and out of scope here — tracked as a follow-up in #23416.

@mustafajw07

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I’ve addressed the issue by updating the side panel toggle to always provide aria-expanded, using true when the panel is open and false when it is collapsed.

This keeps the button aligned with the ARIA Disclosure pattern and consistent with the existing SidePanelDrawer implementation.

The change is done and ready for review.

@rita-codes

Copy link
Copy Markdown
Member

Good job! thanks for taking care of this 🙇‍♀️

@rita-codes
rita-codes merged commit ee6b0ab into mui:master Aug 24, 2026
22 checks passed
@mustafajw07
mustafajw07 deleted the fix/21982-scheduler-side-panel-toggle-aria-attrs branch August 24, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility a11y scope: scheduler Changes related to the scheduler. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scheduler] Add aria-expanded and aria-controls to the side panel toggle button

2 participants