Repository navigation
Change MenuItem default role from menuitem to button for screen reader accessibility - #83520
Conversation
The MenuItem component defaults its role prop to CONST.ROLE.MENUITEM
('menuitem'), but none of these menu items exist inside a container
with role="menu" or role="menubar". Per the ARIA spec, orphaned
menuitem roles cause screen readers (JAWS + Chrome) to not announce
any role, violating WCAG 4.1.2.
Changing the default to CONST.ROLE.BUTTON ensures screen readers
announce these interactive elements as buttons, matching user
expectations across 23+ affected pages (Settings, Workspace, etc.).
Co-authored-by: Rushat Gabhane <rushatgabhane@users.noreply.github.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #74860 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
@MelvinBot COuld you mark this PR is ready? |
|
@DylanDylann Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Done! This PR has been marked as ready for review. ✅ |
Reviewer Checklist
Screenshots/Videos
|
trjExpensify
left a comment
There was a problem hiding this comment.
Accessibility project PR 👍
|
🚧 @thienlnam has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/thienlnam in version: 9.3.27-0 🚀
|
|
Deploy Blocker #83903 was identified to be related to this PR. |
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.3.27-8 🚀
|

Explanation of Change
The
MenuItemcomponent defaults itsroleprop toCONST.ROLE.MENUITEM('menuitem'). Per the ARIA spec,menuitemis only valid inside a container withrole="menu"orrole="menubar", but there are zero such containers in the codebase. This means everyMenuItemrenders with an orphanedrole="menuitem", causing screen readers (JAWS + Chrome) to not announce any role for these elements — users don't know they're interactive.This PR changes the default
rolefromCONST.ROLE.MENUITEMtoCONST.ROLE.BUTTONso that screen readers properly announce these elements as buttons across 23+ affected pages (Settings, Workspace, Reports, etc.).Note:
PopoverMenualready explicitly setsrole={CONST.ROLE.BUTTON}on its items, so it is unaffected by this change.Fixed Issues
$ #74860
PROPOSAL: #74860 (comment)
Tests
Offline tests
This change only affects ARIA role attributes rendered in the DOM. No network requests or data fetching is involved, so offline behavior is unaffected.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A - This is a single-line role attribute change that affects screen reader announcements. Visual appearance is unchanged.
Android: mWeb Chrome
N/A - Visual appearance unchanged.
iOS: Native
N/A - Visual appearance unchanged.
iOS: mWeb Safari
N/A - Visual appearance unchanged.
MacOS: Chrome / Safari
N/A - Visual appearance unchanged. Screen reader now announces interactive menu items as "button" instead of no role.