Skip to content

Troubleshoot - Blank page opens when opening test tools via CMD+D #85871

Closed

Description

@vincdargento

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.3.41-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #79834
Email or phone of affected tester (no customers): sdjsdjosijnsodiosd@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Other

Action Performed:

  1. Go to staging.new.expensify.com
  2. Open test tools via CMD+D.

Expected Result:

Test tools modal will open.

Actual Result:

A blank page opens.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 19, 2026
  2. melvin-bot commented on Mar 19, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #79834

  3. melvin-bot commented on Mar 19, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on Mar 19, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. OSBotify commented on Mar 19, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #79834 - "fix: [Web] Focus restoration mechanism on back navigation (#76921)" by @mavrickdeveloper (High confidence)
    Related Issues: #76921

    Recommendation: REVERT

    PR #79834 introduced a new NavigationFocusManager system to handle keyboard focus restoration during back navigation. This appears to be interfering with the TestToolsModal rendering, causing a blank page instead of the modal content when opening test tools via CMD+D.

    Labels: Keeping DeployBlockerCash (App deploy blocker - frontend fix required). DeployBlocker label is not present on this issue.

    📋 Detailed Analysis

    Evidence

    Verification

    Files affected by the bug:

    • src/libs/Navigation/AppNavigator/Navigators/TestToolsModalNavigator.tsx
    • src/components/TestToolsModalPage.tsx

    PR #79834 modifies:

    • src/components/FocusTrap/FocusTrapForScreen/index.web.tsx (complete rewrite)
    • src/libs/NavigationFocusManager/ (new module, 825 lines)
    • src/App.tsx (initializes NavigationFocusManager)

    Root Cause

    The new FocusTrapForScreen adds complex focus capture/restoration logic. The test tools modal triggers edge case behavior:

    1. CMD+D calls toggleTestToolsModal()
    2. TestToolsModalNavigator mounts with FocusTrapForScreen wrapper
    3. FocusTrapForScreen initialFocus function may return invalid element or cause bad focus trap state
    4. This prevents modal content from rendering, showing blank page

    Key suspicious code:

    • routeKey guards for undefined (line 22)
    • wasNavigatedTo/shouldRestoreFocusWithoutTrap conditional logic
    • Fresh mount detection for non-persistent screens (lines 111-115)
  6. vincdargento commented on Mar 19, 2026

    @vincdargento
    Author

    This issue is reproducible on every snapshot build, no culprit PR was found.

  7. MelvinBot commented on Mar 19, 2026

    @MelvinBot
    Contributor

    Proposal

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

    On staging (v9.3.41-0), pressing CMD+D to open the test tools modal results in a blank page instead of showing the test tools modal. This is a regression introduced by PR #79834 ("fix: [Web] Focus restoration mechanism on back navigation").

    What is the root cause of that problem?

    PR #79834 completely reworked the FocusTrapForScreen web implementation (src/components/FocusTrap/FocusTrapForScreen/index.web.tsx) and added a new NavigationFocusManager system. The test tools "modal" is not a traditional React modal — it is a navigation-based route (/test-tools) rendered by TestToolsModalNavigator, which wraps its content in FocusTrapForScreens (the same modified component).

    The key changes that break the test tools modal:

    1. New <View style={{flex: 1}}> wrapper (line 213-220): PR fix: [Web] Focus restoration mechanism on back navigation (#76921) #79834 added a wrapper <View> inside the <FocusTrap> component. The focus-trap-react library renders its own plain <div> wrapper (no flex styles). The new <View style={{flex: 1}}> inside it has flex-basis: 0% (RN Web's interpretation of flex: 1), which may not expand correctly inside the non-flex parent <div>. Combined with TestToolsModalNavigator's specific layout hierarchy (PressableWithoutFeedback → FocusTrap div → new View → inner View), this can cause the content to collapse or not render visibly.

    2. Focus lifecycle hooks on navigation transitions: When CMD+D triggers Navigation.navigate() to /test-tools:

      • The previous screen's FocusTrapForScreen detects isFocused=false and calls NavigationFocusManager.captureForRoute() (line 117-119)
      • NavigationRoot.handleStateChange calls NavigationFocusManager.cleanupRemovedRoutes() (NavigationRoot.tsx:244)
      • The test tools screen's FocusTrapForScreen activates with onActivate blurring the active element (line 159-164) and initialFocus returning false (line 175-198, since wasNavigatedTo.current starts as false)
      • This complex interplay of focus capture, cleanup, blur, and trap activation during the multi-step async open sequence (Modal.close() → setTimeout(200ms) → Navigation.navigate()) can result in the screen rendering blank
    3. initialFocus and setReturnFocus changed from false to functions: Previously these were simply false (no focus management). Now they are dynamic functions that interact with NavigationFocusManager. This fundamentally changes how focus-trap-react handles focus during trap activation/deactivation for every screen, including the test tools modal.

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

    Since this is a deploy blocker, the safest immediate fix is to revert PR #79834. The focus restoration feature is a UX enhancement, not a bugfix, and should not block the deploy.

    If a revert is not desired, a targeted fix could be explored:

    • Remove the <View style={{flex: 1}}> wrapper from FocusTrapForScreen (line 213-220) and find an alternative way to attach the route boundary dataSet attribute (e.g., via a ref on the FocusTrap container)
    • Alternatively, ensure the focus-trap-react wrapper <div> gets proper flex layout styles so the inner <View style={{flex: 1}}> can expand correctly

    What alternative solutions did you explore? (Optional)

    • Investigated whether NavigationFocusManager.handleKeyDown was intercepting CMD+D — confirmed it does not (it only handles Enter, Space, and Escape at line 415 of NavigationFocusManager/index.web.ts)
    • Investigated whether the PanResponder change in ScreenWrapperContainer (from useRef to useMemo) could cause the issue — this is functionally equivalent and unlikely to be the cause
    • Considered whether clickOutsideDeactivates: true could immediately deactivate the test tools trap — this option existed before PR fix: [Web] Focus restoration mechanism on back navigation (#76921) #79834 and is not new

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  8. ikevin127 commented on Mar 19, 2026

    @ikevin127
    Contributor

    This issue is reproducible on every snapshot build, no culprit PR was found.

    Not sure if this means that the issue is present on staging as well (non-related to our PR, coming from another staging-deployed PR) or it is actually related to our PR.

    If related to our PR, this does seem like a deploy blocker since it prevents usage of dev tools.

  9. cristipaval commented on Mar 20, 2026

    @cristipaval
    Contributor

    Not repro anymore after reverting #79834

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions