Skip to content

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

Open
mantrapatel05 wants to merge 1 commit into
RocketChat:developfrom
mantrapatel05:fix/fuselage-menuoption-aria-selected
Open

mantrapatel05 wants to merge 1 commit into
RocketChat:developfrom
mantrapatel05:fix/fuselage-menuoption-aria-selected

Conversation

@mantrapatel05

@mantrapatel05 mantrapatel05 commented Oct 18, 2026 •

Copy link
Copy Markdown

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.

View guided diff

Summary by CodeRabbit

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

@dionisio-bot

dionisio-bot Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d34cac9

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
could not parse changeset - missing or invalid frontmatter.
Changesets must start with frontmatter delimited by "---".
Example:
---
"package-name": patch
---

Your changeset summary here.
Received content:
��-�-�-�
�
�'�@�r�o�c�k�e�t�.�c�h�a�t�/�f�u�s�e�l�a�g�e�'�:� �p�a�t�c�h�
�
�-�-�-�
�
�
�
�F�i�x�e�s� �`�M�e�n�u�O�p�t�i�o�n�`� �s�e�t�t�i�n�g� �t�h�e� �u�n�s�u�p�p�o�r�t�e�d� �`�a�r�i�a�-�s�e�l�e�c�t�...

@CLAassistant

CLAassistant commented Oct 18, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ef46b7c6-d33d-446b-a01d-a444eb67e244
📥 Commits

Reviewing files that changed from the base of the PR and between d7dc383 and d34cac9.

📒 Files selected for processing: 3
  • .changeset/quiet-menus-listen.md
  • packages/fuselage/src/components/Menu/MenuOption.spec.tsx
  • packages/fuselage/src/components/Menu/MenuOption.tsx
💤 Files with no reviewable changes: 1
  • packages/fuselage/src/components/Menu/MenuOption.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📜 Recent review details
🔇 Additional comments: 1
packages/fuselage/src/components/Menu/MenuOption.spec.tsx: 1

10-10: 📐 Maintainability & Code Quality

The regression test is valid without selected. The previous implementation bound aria-selected={!!selected}, so an omitted selected value still produced aria-selected="false". The absence assertion would fail before this change.

Walkthrough

MenuOption no longer renders aria-selected. Its selected prop still controls the selected CSS class. Tests cover menu roles, selected styling, and axe accessibility for a checked menu item.

Changes

MenuOption ARIA behavior

Layer / File(s) Summary
Remove aria-selected and verify menu behavior
packages/fuselage/src/components/Menu/MenuOption.tsx, packages/fuselage/src/components/Menu/MenuOption.spec.tsx
MenuOption no longer renders aria-selected. Tests verify that the menu roles omit the attribute, selected styling remains, and a checked menuitemcheckbox has no axe violations.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested labels: type: bug

Suggested reviewers: tassoevan

Merge Risk: ⚪ Minimal · up to d34ca

MenuOption no longer emits the unsupported aria-selected attribute, while checked state and selected styling remain intact. The compared changes are ready to merge; the tests were inspected but not executed.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies the main change: removing the unsupported aria-selected attribute from MenuOption.
Linked Issues check Passed Issue #42805 requires omitting unsupported aria-selected for menuitem, menuitemcheckbox, and menuitemradio. MenuOption.tsx removes the attribute. The selected prop still adds `rcx-option--…
Out of Scope Changes check Passed The diff changes only the unsupported attribute and adds focused MenuOption tests. The tests directly verify the behavior required by issue #42805. No unrelated implementation or test changes are pr…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Full details: Linked Issues check

Explanation

Issue #42805 requires omitting unsupported aria-selected for menuitem, menuitemcheckbox, and menuitemradio. MenuOption.tsx removes the attribute. The selected prop still adds rcx-option--selected. The new tests cover all three roles, selected styling, and an axe check for a checked menu item.

Full details: Out of Scope Changes check

Explanation

The diff changes only the unsupported attribute and adds focused MenuOption tests. The tests directly verify the behavior required by issue #42805. No unrelated implementation or test changes are present.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Errors were encountered while retrieving linked issues.

Errors: 1
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/fuselage/src/components/Menu/MenuOption.spec.tsx">

<violation number="1" location="packages/fuselage/src/components/Menu/MenuOption.spec.tsx:6">
P2: This spec tests `MenuOption`, which nothing renders anymore. `Menu` renders items through `MenuItem` → `Item`, and `MenuOption` is only imported for its types. The test therefore gives no coverage of the menu items users actually get, and the `aria-selected` line it guards is in unreachable code. Either delete `MenuOption` and this spec, or move the regression check to `Menu`/`MenuItem` so it exercises the real render path.</violation>
</file>

Reply to a comment to ask cubic a question or push back. It learns from your replies.

View guided diff | Re-trigger cubic

import MenuOption from './MenuOption';
import { render } from '../../testing';

describe('[MenuOption Component]', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This spec tests MenuOption, which nothing renders anymore. Menu renders items through MenuItem → Item, and MenuOption is only imported for its types. The test therefore gives no coverage of the menu items users actually get, and the aria-selected line it guards is in unreachable code. Either delete MenuOption and this spec, or move the regression check to Menu/MenuItem so it exercises the real render path.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/fuselage/src/components/Menu/MenuOption.spec.tsx, line 6:

<comment>This spec tests `MenuOption`, which nothing renders anymore. `Menu` renders items through `MenuItem` → `Item`, and `MenuOption` is only imported for its types. The test therefore gives no coverage of the menu items users actually get, and the `aria-selected` line it guards is in unreachable code. Either delete `MenuOption` and this spec, or move the regression check to `Menu`/`MenuItem` so it exercises the real render path.</comment>

<file context>
@@ -0,0 +1,42 @@
+import MenuOption from './MenuOption';
+import { render } from '../../testing';
+
+describe('[MenuOption Component]', () => {
+	it.each(['menuitem', 'menuitemcheckbox', 'menuitemradio'] as const)('should not set aria-selected on %s', (role) => {
+		const { getByRole } = render(
</file context>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fair point — MenuOption isn’t used by the current menu anymore since #42818. I kept this PR focused on the fix requested in #42805. @tassoevan, would you prefer I leave it as is or remove MenuOption and move its shared types? Happy to make whichever change you prefer.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(fuselage): MenuOption sets unsupported aria-selected on menu items

2 participants