Skip to content

fix(fab): expose expanded state on the FAB.Menu trigger - #5151

Open
Ganeshguru5 wants to merge 1 commit into
callstack:mainfrom
Ganeshguru5:fix/fab-menu-trigger-aria-expanded
Open

Ganeshguru5 wants to merge 1 commit into
callstack:mainfrom
Ganeshguru5:fix/fab-menu-trigger-aria-expanded

Conversation

@Ganeshguru5

Copy link
Copy Markdown

Motivation

The FAB.Menu trigger opens and closes the menu, but it never exposes whether the menu is open. Screen readers announce it as a plain "button" with no expanded or collapsed state, so users can't tell what pressing it will do.

Shell already accepts aria-expanded and forwards it to the interactive control. Menu just wasn't passing expanded to the trigger.

Related issue

No existing issue or PR covers this. I checked open PRs that touch src/components/FAB/Menu.tsx, including #5110, and none add aria-expanded. This is the same kind of fix as #5148 for Button.

Since #5110 also edits Menu.tsx, I'm happy to rebase after it, or to fold this into #5110 if that's easier.

Screenshots / Videos

No visual change. The trigger's aria-expanded attribute on web, checked in the running example app (FAB screen, type "menu"):

Menu state Before After
Closed absent aria-expanded="false"
Open absent aria-expanded="true"

Test plan

  1. Run the example app on web and open Floating Action Button, then select type menu.
  2. Inspect the trigger <button> in dev tools. It shows aria-expanded="false".
  3. Press the trigger to open the menu. It shows aria-expanded="true". Press it again and it goes back to "false".

I only checked web. I haven't tested on iOS or Android devices.

Automated:

  • New test exposes the expanded state on the trigger queries the trigger by role and name and asserts toBeCollapsed() / toBeExpanded(). It fails without the fix and passes with it.
  • 7 FABMenu snapshots were updated. The only change in each is expanded: undefined → true/false.
  • yarn test: 708 passed, 1 skipped; yarn typecheck and yarn lint pass.

🤖 Generated with Claude Code

The trigger FAB toggles the menu but never set aria-expanded, so
assistive technology announced it as a plain button with no open or
closed state. Forward `expanded` to Shell, which already passes
aria-expanded through to the interactive control.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Found potential problems with the pull request:

  • The description is too long. Please keep it under 1000 characters.
  • Screenshot or video evidence is missing. Make sure to include one if it affects the UI.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant