fix(fuselage): remove unsupported aria-selected from MenuOption

MA
14d ago
+42-1

Proposed changes

MenuOption always set aria-selected on its element. But menu items (menuitem, menuitemcheckbox, menuitemradio) don't support that attribute, so every item got an invalid aria-selected="false" and axe flagged it.

I removed that line. Checkable items already use aria-checked, and the selected class still works the same, so nothing changes visually.

Also added a small test file for it. It fails with the old code and passes with the fix.

Heads up: since #42818, Menu renders Item, so MenuOption is only used for its types now. Happy to delete it instead if you'd prefer.

Issue(s)

Closes #42805

Steps to test or reproduce

Run yarn jest src/components/Menu in packages/fuselage.

Further comments

Only touched the attribute, nothing else.

Summary by CodeRabbit

  • Bug Fixes
    • Menu options no longer expose aria-selected; the selected prop continues to apply the selected styling.