Skip to content

[Due for payment 2026-05-20] [Due for payment 2026-05-18] [$250] Distance - RHP returns to previous tab after changing distance tab and clicking RHP back button #90056

Closed

Description

@jponikarchuk

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.69-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: #89858
Email or phone of affected tester (no customers): josdjnosdjionjsdonjisod@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to self DM.
  3. Create a map distance expense.
  4. Open the expense.
  5. Click Distance.
  6. Go to Manual tab (or Distance tab if currently on Manual tab).
  7. Click RHP back button.

Expected Result:

RHP will close.

Actual Result:

RHP returns to previous tab instead of closing.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Video.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022053833503578312407
  • Upwork Job ID: 2053833503578312407
  • Last Price Increase: 2026-05-11
Issue OwnerCurrent Issue Owner: @aimane-chnaif

Activity

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

    @melvin-bot

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

  3. melvin-bot commented on May 8, 2026

    @melvin-bot

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

  4. github-actions commented on May 8, 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 May 8, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #89858 - "fixed manual distance tab blockers" by @mukhrr (High confidence)
    Related Issues: #83781

    Recommendation: REVERT

    PR #89858 introduced an OnyxTabNavigator wrapping the distance editing screen. The OnyxTabNavigator uses backBehavior="initialRoute", which causes React Navigation's material top tab navigator to intercept the back button press and navigate to the initial tab (Distance Map) rather than propagating the back event up to close the RHP. Reverting this PR would immediately restore the previous back navigation behavior.

    Note: The PR author explicitly requested it not be reverted in the PR body and mentioned a follow-up fix PR (#89976) that could hide the manual tab temporarily. If reverting is genuinely not feasible, cherry-picking #89976 to staging may be an acceptable alternative, but a clean revert is the safest path.

    Assigned: @mukhrr (PR author), @aimane-chnaif (approving reviewer), @youssef-lr (approving reviewer)
    Labels: Keeping DeployBlockerCash (frontend App PR is the cause). No label changes needed beyond removing Engineering if applicable.

    Detailed Analysis

    Evidence

    • The bug is staging-only (not reproducible in production), which matches it being introduced by a recently merged PR.
    • melvin-bot already identified PR fixed manual distance tab blockers #89858 as the causing PR (comment on issue).
    • PR fixed manual distance tab blockers #89858 is listed in the StagingDeployCash deploy checklist for version 9.3.69-0.
    • The PR description says "Go to Manual tab (or Distance tab if currently on Manual tab). Click RHP back button. Expected: RHP will close. Actual: RHP returns to previous tab instead of closing." — this exactly matches the bug report.

    Verification

    • The affected feature is the distance expense editing flow, specifically in src/pages/iou/request/step/IOURequestStepDistance.tsx.
    • PR fixed manual distance tab blockers #89858 directly modifies src/pages/iou/request/step/IOURequestStepDistance.tsx (283 additions, 84 deletions) — confirmed via gh pr view.
    • PR fixed manual distance tab blockers #89858 introduces OnyxTabNavigator wrapping for the distance editing screen when isEditing is true, with backBehavior="initialRoute" set in OnyxTabNavigator.tsx (line 181).

    Root Cause

    OnyxTabNavigator uses createMaterialTopTabNavigator with backBehavior="initialRoute". When the user is on the "Manual" tab and presses the back button, the React Navigation tab navigator intercepts the hardware/gesture back event and navigates to the initial tab (Distance Map tab) instead of propagating the back event to the parent StepScreenWrapper which would close the RHP. This is a navigation event bubbling issue introduced by wrapping the distance editing screen in a tab navigator that has its own back behavior.

  6. MelvinBot commented on May 8, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The OnyxTabNavigator is configured with backBehavior="initialRoute", which tells the material top tab navigator to handle GO_BACK actions by switching to the initial tab before bubbling up to the parent navigator.

    When the user opens the distance edit screen from a report in the central pane (not the RHP), getReportRHPActiveRoute() returns an empty string, so backTo is undefined. When the header back button calls Navigation.goBack(undefined), the fallback path dispatches a generic goBack() on the navigation ref. The tab navigator intercepts this and switches back to the Map tab (the initial route) instead of closing the RHP. The user must press back twice — once to reset to the initial tab, once to actually close.

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

    In navigateBack, when backTo is falsy, use Navigation.closeRHPFlow() (or Navigation.dismissModal()) instead of Navigation.goBack() so the back button always tears down the RHP screen rather than dispatching a generic GO_BACK that the tab navigator intercepts. This is consistent with how other edit-step screens handle the "no backTo" case.

    What alternative solutions did you explore? (Optional)

    Changing backBehavior from "initialRoute" to "none" on the OnyxTabNavigator would also fix this, but it would change behavior globally for all tab navigators in the app, which could have unintended side effects. The targeted fix in navigateBack is safer and scoped to the distance edit flow.

    Investigation details

    Data flow:

    1. User views a distance expense report (central pane) → clicks "Distance" → MoneyRequestView navigates to STEP_DISTANCE with backTo=getReportRHPActiveRoute()
    2. getReportRHPActiveRoute() returns '' because the report is in the central pane → backTo is undefined
    3. IOURequestStepDistance renders OnyxTabNavigator with Map and Manual tabs (backBehavior="initialRoute")
    4. User switches to Manual tab → presses header back → navigateBack() → Navigation.goBack(undefined)
    5. goBack dispatches generic GO_BACK → tab navigator intercepts → switches to Map tab instead of closing RHP

    Related issue: #90037 (crash on back button in split distance waypoints editor) may share the same navigation root cause.


    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.

  7. mukhrr commented on May 9, 2026

    @mukhrr
    Contributor

    @aimane-chnaif or anyone, can you you reproduce the issue? I cannot :(

    Oh now I can reproduce it

  8. 6 remaining items

  9. melvin-bot commented on May 11, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  10. melvin-bot commented on May 11, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  11. changed the title [-][$250] Distance - RHP returns to previous tab after changing distance tab and clicking RHP back button[/-] [+][Due for payment 2026-05-18] [$250] Distance - RHP returns to previous tab after changing distance tab and clicking RHP back button[/+] on May 11, 2026
  12. melvin-bot commented on May 11, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  13. melvin-bot commented on May 11, 2026

    @melvin-bot

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

    If no regressions arise, payment will be issued on 2026-05-18. 🎊

    For reference, here are some details about the assignees on this issue:

  14. melvin-bot commented on May 11, 2026

    @melvin-bot

    @aimane-chnaif The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero 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]

  15. changed the title [-][Due for payment 2026-05-18] [$250] Distance - RHP returns to previous tab after changing distance tab and clicking RHP back button[/-] [+][Due for payment 2026-05-20] [Due for payment 2026-05-18] [$250] Distance - RHP returns to previous tab after changing distance tab and clicking RHP back button[/+] on May 13, 2026
  16. melvin-bot commented on May 13, 2026

    @melvin-bot

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

    If no regressions arise, payment will be issued on 2026-05-20. 🎊

    For reference, here are some details about the assignees on this issue:

  17. melvin-bot commented on May 13, 2026

    @melvin-bot

    @aimane-chnaif The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero 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]

  18. lanitochka17 commented on May 13, 2026

    @lanitochka17

    Deploy Blocker ##90558 was identified to be related to the PR ##90131 that attempted to fix this issue.

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions