App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-11-28] [$175] Accessibility - Keyboard focus on Home page skips the navigation bar tabs (e.g., Account); tabs only receive focus after pressing a link on the Home page

Open m-natarajan opened this issue 2 weeks ago • 23 comments

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.40-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @Eskalifer1 Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Sign in to New Expensify and land on the Home page.
  2. Using only the keyboard, press Tab repeatedly to move focus.
  3. Try to reach the navigation bar tabs (e.g., Account).

Expected Result:

Keyboard users can Tab to the navigation bar elements (Inbox, Spend, Account, etc.) directly from the Home page and move between tabs without first interacting with page content.

Actual Result:

  • On the Home page, Tab never moves focus to the NavBar elements. Focus appears to get stuck within the Home page content.
  • The tabs only become focusable after the user first presses a link on the Home page.
  • Users can't go straight to the tab they need (such as Account).

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [ ] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [x] Windows: Chrome
  • [x] MacOS: Chrome / Safari

Screenshots/Videos

https://github.com/user-attachments/assets/0ec2883e-2f4e-4698-bb2b-a52caef43eed

https://github.com/user-attachments/assets/8b41cda8-325d-4127-a3fd-1b836b6f454c

View all open jobs on GitHub

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

m-natarajan avatar Nov 17 '26 21:11 m-natarajan

Triggered auto assignment to Contributor-plus team member for initial proposal review - @huult (External)

Job added to Upwork: https://www.upwork.com/jobs/~022122801062322657950

🤖 Web test steps verification results: ⚠️ partial

Verified signed-in Home on dev NewDot web. Keyboard reproduction was blocked because the supported web CLI cannot dispatch Tab/Shift+Tab. Signed-in Home with global navigation and empty content sections

Step Status
1: Sign in and land on HomeConfirmed an authenticated session with the Home heading visible.
Signed-in Home with global navigation and empty content sections
✅
2: Without clicking Home content, repeatedly Tab and record whether focus cycles inside HomeKeyboard traversal could not be executed. Static investigation identified a likely cause, with medium confidence.

Proposal

What is the root cause of that problem?

Home inherits a screen-local focus trap through ScreenWrapper:284–316. Unlike other desktop root screens, Home is missing from WIDE_LAYOUT_INACTIVE_SCREENS.ts:3–49. Consequently, FocusTrapForScreen:38–65 activates containment while Home is focused. The global navigation is rendered separately by TabNavigator:87–120, outside Home’s trap. This explains Tab cycling through page content instead of reaching navigation.

What changes do you think we should make in order to solve the problem?

Add SCREENS.HOME to the existing wide-layout exemption list. This targets desktop Home without changing narrow-layout or modal trapping. Add policy tests for wide/narrow Home and explicit trap overrides, then browser regression coverage for Tab and Shift+Tab reaching Account on fresh Home and after returning Home. Confirm modal focus containment remains intact.
⚠️
3: Reach global navigation tabs, especially Account, by keyboard aloneAccount was visible, but keyboard reachability remains unverified.
Alternative considered: missing tabIndex or disabled navigation controls. The shared GenericPressable:14–48 already defaults accessible, focusable controls to tabIndex=0. Changing tabIndex would not remove Home’s containment boundary.
⚠️
4: Activate a Home content link and check whether global navigation becomes keyboard-reachableThe test account had no applicable content link, so the reported recovery remains unverified. Navigating away from Home to an exempt screen would explain recovery because Home’s trap becomes paused when unfocused. Activating an arbitrary link while remaining on Home does not establish that explanation; the exact link and destination still need verification.
⚠️

Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/107168) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run · no recording available

MelvinBot avatar Nov 17 '26 21:11 MelvinBot

Proposal

Please re-state the problem that we are trying to solve in this issue.

On desktop web, pressing Tab on the Home page keeps focus inside the Home content, so keyboard users can't reach the navigation tabs (Inbox, Spend, Account, …) until they open something from Home.

What is the root cause of that problem?

HomePage renders inside ScreenWrapper, which wraps every screen in FocusTrapForScreen (src/components/ScreenWrapper/index.tsx). On web, src/components/FocusTrap/FocusTrapForScreen/index.web.tsx decides whether the trap is active:

isActive =
    !isSidebarScreenName(route.name) &&
    (TOP_TAB_SCREENS.find((screen) => screen === route.name) ? isFocused : !(WIDE_LAYOUT_INACTIVE_SCREENS.includes(route.name) && !shouldUseNarrowLayout) && isFocused);

The other tab roots that sit next to the navigation tab bar on wide screens (SCREENS.INBOX, SCREENS.SEARCH.ROOT, SCREENS.SETTINGS.ROOT, SCREENS.WORKSPACES_LIST, …) are listed in src/components/FocusTrap/WIDE_LAYOUT_INACTIVE_SCREENS.ts. That file's own comment says those screens "should not have active focus trap when rendered on a wide screen to allow navigation between them using the keyboard".

SCREENS.HOME isn't in that list, and it isn't a sidebar screen either (isNavigatorName.ts puts it in FULL_SCREENS_SET, not SIDEBARS_SET). So on Home the trap is active and Tab cycles only through the Home content. Once the user opens something from Home, they land on a screen that is in the list (e.g. Inbox/Search), the trap is gone, and the tabs become reachable. That matches the reported behavior.

What changes do you think we should make in order to solve the problem?

Add SCREENS.HOME to WIDE_LAYOUT_INACTIVE_SCREENS so Home behaves like the other tab roots on wide layouts. Narrow layout stays unchanged, because the check is already gated on !shouldUseNarrowLayout.

SCREENS.INSIGHTS is the other root in FULL_SCREENS_SET that's missing from the list too, so while fixing this I'd check that tab and add it if it has the same problem.

What specific scenarios should we cover in automated tests?

  • Unit test: FocusTrapForScreen (web) with route SCREENS.HOME on a wide layout → trap active is false, and with narrow layout it behaves as before.
  • Manual: on Home, press Tab repeatedly → focus reaches the navigation tabs and can move to Account without clicking anything first. Check the same on Inbox/Spend.

What alternative solutions did you explore?

Pass focusTrapSettings={{active: false}} (or containerElements that include the tab bar) from useTabRootScreenWrapperProps for Home. It works, but it's a one-off override, while every sibling tab root uses WIDE_LAYOUT_INACTIVE_SCREENS.

fitzyracing1 avatar Nov 17 '26 22:11 fitzyracing1

@MelvinBot Please create a proposal for this.

huult avatar Nov 18 '26 03:11 huult

Proposal

What is the root cause of that problem?

Home’s web focus trap contains keyboard focus within the page content, while the desktop navigation bar sits outside it. Unlike other desktop root screens, Home is missing from the list that disables screen-level trapping on wide layouts.

Code evidence

Confidence: medium. The code explains the containment. Keyboard behavior remains unverified because the previous browser test could not dispatch Tab/Shift+Tab. Navigating to an exempt screen explains the reported recovery; activating an arbitrary link while staying on Home is not yet explained.

What changes do you think we should make in order to solve the problem?

Add SCREENS.HOME to the existing wide-layout exemption list. This makes Home consistent with sibling root screens while preserving narrow-layout behavior and independent modal trapping.

Regression coverage should verify:

  • Focused Home disables its screen trap on wide layouts but retains existing narrow-layout behavior.
  • Tab and Shift+Tab reach global navigation, including Account, on fresh Home and after returning.
  • Modal focus containment and other screens remain unchanged.

What alternative solutions did you explore? (Optional)

A Home-specific trap override would duplicate the existing exemption mechanism. Changing navigation controls’ tab order would not remove Home’s containment boundary.


Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/107168) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run

MelvinBot avatar Nov 18 '26 03:11 MelvinBot

This issue was caused by PR #80504. SCREENS.HOME was previously exempted from the trap, but its name was later changed. During that change, we moved the exemption list to INBOX but forgot to add HOME back for the new Home screen.

So we only need to add SCREENS.HOME and SCREENS.INSIGHTS to WIDE_LAYOUT_INACTIVE_SCREENS. INSIGHTS is needed because it has the same problem: it is a tab root next to the nav bar, wrapped in FocusTrapForScreen via ScreenWrapper, and was never added to the list, so Tab cycles only inside the page content.

https://github.com/user-attachments/assets/f4b141f4-b9fb-46c0-a574-599c0526f94d

So we can go with @MelvinBot's proposal, since it has the right direction. It only needs a small adjustment: add SCREENS.INSIGHTS alongside SCREENS.HOME.

🎀 👀 🎀 c+ reviewed.

huult avatar Nov 18 '26 06:11 huult

Triggered auto assignment to @Beamanator, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Proposal

What is the root cause of that problem?

Both Home and Insights activate a screen-level focus trap that excludes the desktop navigation bar. Neither screen has the wide-layout exemption needed to let keyboard focus reach that bar.

Supporting evidence

What changes do you think we should make in order to solve the problem?

Add both SCREENS.HOME and SCREENS.INSIGHTS to the wide-layout exemption list. No other production-code changes are needed.

Regression coverage should verify that both screens allow Tab/Shift+Tab to reach navigation, including Account, without opening page content first. Narrow-layout behavior and modal focus containment should remain unchanged.


Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/107168#issuecomment-6970848883) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run

MelvinBot avatar Nov 18 '26 06:11 MelvinBot

Sounds good here, let's move forward @huult 👍

Beamanator avatar Nov 18 '26 14:11 Beamanator

@MelvinBot implement this to create a draft PR.

huult avatar Nov 18 '26 15:11 huult

⏱️ Ran out of time before I could finish. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in #melvinbot-ai.

Run details

MelvinBot avatar Nov 18 '26 15:11 MelvinBot

Proposal

Please re-state the problem that we are trying to solve in this issue.

When landing on the Home page on web, pressing Tab cycles keyboard focus exclusively inside the Home page content and never reaches the global navigation bar (Inbox, Spend, Workspaces, Account, etc.) until the user first activates a link that navigates away from Home (or breaks the trap via mouse interaction).

What is the root cause of that problem?

TabNavigator (src/libs/Navigation/AppNavigator/Navigators/TabNavigator.tsx:87-141) renders TabNavigatorBar (FlatNavigationBar / NavigationTabBar) outside each tab screen's ScreenWrapper (FocusTrapForScreen). Inside src/components/FocusTrap/FocusTrapForScreen/index.web.tsx:45-48, the focus trap defaults to active unless exempted:

isActive =
    !isSidebarScreenName(route.name) &&
    (TOP_TAB_SCREENS.find((screen) => screen === route.name) ? isFocused : !(WIDE_LAYOUT_INACTIVE_SCREENS.includes(route.name) && !shouldUseNarrowLayout) && isFocused);

There are two coupled gaps in this condition (which explain why adding SCREENS.HOME and SCREENS.INSIGHTS to WIDE_LAYOUT_INACTIVE_SCREENS alone is still incomplete on narrow web):

  1. Wide layout (!shouldUseNarrowLayout) — SCREENS.HOME and SCREENS.INSIGHTS (regressed from PR #80504) are missing from WIDE_LAYOUT_INACTIVE_SCREENS: Unlike SCREENS.INBOX, SCREENS.SEARCH.ROOT, SCREENS.WORKSPACES_LIST, and SCREENS.SETTINGS.ROOT, neither SCREENS.HOME nor SCREENS.INSIGHTS was added to src/components/FocusTrap/WIDE_LAYOUT_INACTIVE_SCREENS.ts, and neither is in SIDEBARS_SET (isSidebarScreenName is false). As a result, FocusTrap activates on Home and Insights and traps Tab inside ScreenWrapper. Once the user presses a Home link that navigates to an exempted route (such as SCREENS.SEARCH.ROOT or SCREENS.REPORT), Home unfocuses (paused={!isFocused}, active={false}) and the destination screen's trap is inactive, making the navigation bar reachable.

  2. Narrow web (shouldUseNarrowLayout === true, e.g. resized desktop Chrome/Safari < 800px or mWeb) — TabBarBottomContent is inert while TabNavigatorBar sits outside FocusTrapForScreen: When a tab is at its root route (isTabRouteAtRoot(activeRoute) === true) and no blocking view is visible, TabNavigatorBar (src/libs/Navigation/AppNavigator/Navigators/TabNavigatorBar.tsx:53-89) sets isNavigatorTabBarVisible = true and renders the only interactive <NavigationTabBar> outside ScreenWrapper. Meanwhile, the in-screen copy rendered by TabBarBottomContent (src/components/Navigation/TabBarBottomContent/index.tsx:26-34) wraps <NavigationTabBar> in <AlwaysPaintedView inert={isNavigatorTabBarVisible}>, which sets the DOM inert attribute (src/components/AlwaysPaintedView/index.tsx:55). Inbox (BaseSidebarScreen) and Account (InitialSettingsPage) only remained keyboard-accessible on narrow web because isSidebarScreenName(route.name) is true regardless of shouldUseNarrowLayout. Keeping HOME (as well as the other non-sidebar tab roots SEARCH.ROOT, INSIGHTS, and WORKSPACES_LIST) gated behind !shouldUseNarrowLayout still traps Tab away from the bottom navigation bar in narrow web viewports whenever !isBlockingViewVisible.

What changes do you think we should make in order to solve the problem?

  1. Add SCREENS.HOME and SCREENS.INSIGHTS to src/components/FocusTrap/WIDE_LAYOUT_INACTIVE_SCREENS.ts.
  2. Add src/components/FocusTrap/TAB_BAR_ROOT_INACTIVE_SCREENS.ts containing the non-sidebar tab-root screens whose live NavigationTabBar is rendered outside ScreenWrapper by TabNavigatorBar (SCREENS.HOME, SCREENS.SEARCH.ROOT, SCREENS.INSIGHTS, SCREENS.WORKSPACES_LIST).
  3. In src/components/FocusTrap/FocusTrapForScreen/index.web.tsx, read const {isBlockingViewVisible} = useFullScreenBlockingViewState(); (from @components/FullScreenBlockingViewContextProvider, matching TabNavigatorBar.tsx:36,53) and compute:
    • isTabBarVisibleOutsideScreen = (WIDE_LAYOUT_INACTIVE_SCREENS.includes(route.name) && !shouldUseNarrowLayout) || (TAB_BAR_ROOT_INACTIVE_SCREENS.has(route.name) && !(shouldUseNarrowLayout && isBlockingViewVisible));
    • Use !isTabBarVisibleOutsideScreen && isFocused in the default isActive branch. This lets Tab / Shift+Tab reach the navigation bar on Home (and Insights / sibling tab roots) across both wide and narrow web layouts, while keeping the focus trap active on narrow-layout blocking views, non-root stack screens (!isAtRoot), TOP_TAB_SCREENS, and all RHP/modal screens.
  4. Extend tests/unit/FocusTrapForScreenTest.tsx to cover SCREENS.HOME and SCREENS.INSIGHTS on wide layout, non-sidebar tab roots on narrow layout (with isBlockingViewVisible both false and true), deeper non-root screens on narrow layout, and RHP modal screens.

What alternative solutions did you explore?

  1. Only adding SCREENS.HOME and SCREENS.INSIGHTS to WIDE_LAYOUT_INACTIVE_SCREENS: Fixes wide desktop Home and Insights, but still leaves Home, Spend, Insights, and Workspaces trapped out of the external TabNavigatorBar in narrow web viewports (< 800px / mWeb) because TabBarBottomContent sets inert={true}.
  2. Registering TabNavigatorBar's DOM node in FocusTrapExtraContainersContext: FocusTrapExtraContainersContext sits at the root above RHP modals as well, so adding TabNavigatorBar there would allow Tab to leak out of RHP modal screens (FocusTrapForScreenTest.tsx) into the background tab bar. Scoping inactivity to screens where TabNavigatorBar is legitimately interactive preserves strict modal/RHP focus containment.

Fabtech21 avatar Nov 18 '26 21:11 Fabtech21

@MelvinBot implement this to create a draft PR.

huult avatar Nov 19 '26 01:11 huult

@huult I sent you a Slack DM to connect GitHub. I will continue the original request once you are connected.

melvin-bot[bot] avatar Nov 19 '26 01:11 melvin-bot[bot]

Melvin needs to make the fix, so to speed things up, I’ll use my AI agent to open the PR

huult avatar Nov 19 '26 01:11 huult

@huult

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.5.51-1 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

  • https://github.com/Expensify/App/pull/107347

If no regressions arise, payment will be issued on 2026-11-28. :confetti_ball:

The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

melvin-bot[bot] avatar Nov 21 '26 01:11 melvin-bot[bot]

Contributor+ Checklist:

  • [x] [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to the comment on the PR: https://github.com/Expensify/App/pull/80504/changes#r4657185938 Link to the comment on the Issue: https://github.com/Expensify/App/issues/79978

  • [x] [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion: N/A

  • [x] [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Regression Test Proposal

  1. Open New Expensify in Chrome on a wide window (desktop layout) and sign in.
  2. Go to the Home tab.
  3. Without clicking anything on the page, press Tab repeatedly.
  4. Verify that focus reaches the Home, Inbox, Spend, Insights, Workspaces and Account tabs before moving into the page content.
  5. Press Shift+Tab from the page content.
  6. Verify that focus moves back through Account, Workspaces, Insights and Spend.
  7. Go to the Insights tab.
  8. Without clicking anything on the page, press Tab repeatedly.
  9. Verify that focus reaches the navigation bar tabs (Inbox, Spend, Account, etc.) before moving into the page content.

Do we agree 👍 or 👎.

huult avatar Nov 22 '26 07:11 huult

Triggered auto assignment to @mallenexpensify (Awaiting Payment)

Payment Summary

Resolving PRs:

  • https://github.com/Expensify/App/pull/107347

  • Reviewer: @huult owed $175 via NewDot

BugZero Checklist (@mallenexpensify)

  • [ ] I have confirmed assignees, roles, and Upwork contracts look correct
  • [ ] I have paid out Upwork contracts / manual NewDot requests
  • [ ] [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon