Fix screen reader focus not moving to opened menu on mWeb#81390
Fix screen reader focus not moving to opened menu on mWeb#81390marufsharifi wants to merge 4 commits intoExpensify:mainfrom
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5c8753c7c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const focusTarget = element.querySelector<HTMLElement>('button, [href], [role="button"], [role="link"], [tabindex]:not([tabindex="-1"])'); | ||
| if (focusTarget && focusTarget !== activeElement) { | ||
| focusTarget.focus(); | ||
| return; |
There was a problem hiding this comment.
Skip disabled elements before returning after focus()
On mWeb this effect is responsible for moving screen-reader focus, but it unconditionally returns after calling focus() on the first button/[role] element. If that element is disabled (e.g., a header “Save” button that starts disabled on many edit screens), focus() is a no-op and the early return prevents the fallback call to Accessibility.moveAccessibilityFocus, so focus stays on the previous screen. This means opening a screen with a disabled first control won’t move accessibility focus at all. Consider skipping disabled/aria-disabled candidates or only returning after confirming focus actually moved.
Useful? React with 👍 / 👎.
Explanation of Change
Ensure screen reader focus shifts correctly when menus open across pages.
Fixed Issues
$ #74858
PROPOSAL: #74858 (comment)
Tests
settings > aboutOffline tests
Same as the tests.
QA Steps
Same as the tests.
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand 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
android-native-bottom-tabs-not-announce.mp4
Android: mWeb Chrome
android-mweb-bottom-tabs-not-announce.mp4
iOS: Native
Screen.Recording.2026-02-08.at.3.16.57.PM.mov
iOS: mWeb Safari
Screen.Recording.1404-11-19.at.5.38.54.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-02-08.at.1.15.24.PM.mov