Skip to content

[Due for payment 2026-10-27] Web- Browser back button doesn't dismiss "You appear to be offline" alert #104154

Open

Description

@applause-bot

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


Version Number: v9.5.10-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: #103554
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Desktop / Windows 11
App Component: Other

Action Performed:

Preconditions:

  • The account has a workspace.
  • There are a couple of unreported expenses.
  • There are a couple of expenses in a report.
  1. Open the Expensify WebApp and log in with the account from the Precondition
  2. Go to Account / Troubleshooting and switch the "Force offline" toggle on
  3. Go to Search / Expenses and select several different expenses
  4. Click on "Export" and select any option ("Basic export", for example)
  5. When the "You appear to be offline" modal appears, click the browser back button and observe

Expected Result:

The "You appear to be offline" modal should be dismissed.

Actual Result:

The "You appear to be offline" modal is not dismissed.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

_To b

Bug7287536_1792091369696.Expensify_PR103554_Back_Web.mp4

e added by Applause Leads_

View all open jobs on GitHub

Applause Internal Information
Exported by: Chandana Kiran
Bug ID: 7287536

Issue OwnerCurrent Issue Owner: @ZhenjaHorbach

Activity

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

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/9b4c88ebdd604ea4de683438140fb243b5de4b2aeba0c6cb985585ee43690132

  3. melvin-bot commented on Oct 15, 2026

    @melvin-bot

    @roryabraham recently merged #103554, but they are OOO right now, so I'll auto-assign someone else.

  4. melvin-bot commented on Oct 15, 2026

    @melvin-bot

    Triggered auto assignment to @carlosmiceli (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  5. github-actions commented on Oct 15, 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.
  6. melvin-bot commented on Oct 15, 2026

    @melvin-bot

    @roryabraham @ZhenjaHorbach you have been assigned to this deploy blocker because you reviewed the offending PR: #103554

  7. melvin-bot commented on Oct 15, 2026

    @melvin-bot

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

  8. MelvinBot commented on Oct 15, 2026

    @MelvinBot
    Contributor

    Deploy Blocker Analysis

    Causing PR: Use useDecisionModal for Search bulk actions and SelectionToolbar alerts (high confidence). It is a real regression: production dismisses the modal on browser Back.

    Recommendation: Revert. The revert applies cleanly to staging (a3d62cc) and main (7e9ad84). The PR is a refactor, so reverting costs little. There is no verified small roll-forward fix yet.

    Root cause: The PR replaced the inline <DecisionModal> in the Search screen with the global useDecisionModal modal, which renders at the app root. Before, browser Back navigated away and the modal went with the screen. Now the modal lives outside the screen, so only its history back-guard can close it, and that guard does not fire in this flow.

    Investigation details

    Why this PR

    Production

    Staging

    Why the guard doesn't fire (unconfirmed hypothesis): In @react-navigation/native 7.4.1, browser Back sends goBack() to the innermost active navigator. If the Search stack or tab history can go back, it handles the action, so the root-level guard entry is never removed. I did not reproduce this in a running app.

    Why not a quick fix

    • Setting shouldHandleNavigationBack: false makes it worse: Back navigates, but the root modal stays on top.
    • Closing the modal from a navigation listener risks an extra browser back when the guard cleans up.
    • Before re-landing, prove the guard closes on browser Back in Search and SelectionToolbar, and add a test for it.

    Severity: Low. It affects web only, offline only, after browser Back, and "Got it" still dismisses it. Demoting is defensible if the team wants to keep the refactor. Given the clean revert and the Android stuck-alert risk, reverting is the safer choice.


    Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.


    view run

  9. ZhenjaHorbach commented on Oct 15, 2026

    @ZhenjaHorbach
    Contributor

    Looks like all modals that use the global modal have the same issue in prod also
    I'm pretty sure it's related to the latest react-navigation updates

    @TMisiukiewicz
    Can you take a look, please?

  10. ZhenjaHorbach commented on Oct 15, 2026

    @ZhenjaHorbach
    Contributor

    Okay
    Confirm
    It's related to react navigation

    And I have a patch that we can use as a temporary fix at least

    diff --git a/patches/react-navigation/@react-navigation+native+7.4.1+001+initial.patch b/patches/react-navigation/@react-navigation+native+7.4.1+001+initial.patch
    index b16466d5d91..c323f024fed 100644
    --- a/patches/react-navigation/@react-navigation+native+7.4.1+001+initial.patch
    +++ b/patches/react-navigation/@react-navigation+native+7.4.1+001+initial.patch
    @@ -84,7 +84,7 @@ index 0000000..b996822
     +}
     +//# sourceMappingURL=findFocusedRouteKey.js.map
     diff --git a/node_modules/@react-navigation/native/lib/module/useLinking.js b/node_modules/@react-navigation/native/lib/module/useLinking.js
    -index af0cd61..fb06350 100644
    +index af0cd61..2805780 100644
     --- a/node_modules/@react-navigation/native/lib/module/useLinking.js
     +++ b/node_modules/@react-navigation/native/lib/module/useLinking.js
     @@ -4,6 +4,7 @@ import { CommonActions, findFocusedRoute, getActionFromState as getActionFromSta
    @@ -139,7 +139,19 @@ index af0cd61..fb06350 100644
      export function useLinking(ref, {
        enabled = true,
        config,
    -@@ -411,6 +449,9 @@ export function useLinking(ref, {
    +@@ -266,7 +304,10 @@ export function useLinking(ref, {
    +       if (record?.path === path && record?.state) {
    +         const currentState = navigation.getRootState();
    +         const [currentFocused, recordFocused] = findMatchingState(currentState, record.state);
    +-        if (previousIndex - index === 1 && currentFocused && recordFocused && isPoppingLastEntry(currentFocused, recordFocused)) {
    ++        // Custom string history entries (e.g. modal back-guards) aren't routes, so no router can pop them with GO_BACK.
    ++        // Reset to the record's state instead, which drops the custom entry.
    ++        const isPoppingCustomHistoryEntry = typeof currentFocused?.history?.at(-1) === 'string';
    ++        if (previousIndex - index === 1 && currentFocused && recordFocused && !isPoppingCustomHistoryEntry && isPoppingLastEntry(currentFocused, recordFocused)) {
    +           const pending = pendingPopStateDeltaRef.current;
    + 
    +           // If we detect that the state change is popping the last entry
    +@@ -411,6 +452,9 @@ export function useLinking(ref, {
              const historyDelta = getHistoryLength(focusedState) - getHistoryLength(previousFocusedState) - (
              // Subtract the delta already applied by the browser to sync only the remaining changes
              pendingPopStateDelta ?? 0);
    @@ -149,7 +161,7 @@ index af0cd61..fb06350 100644
              if (historyDelta > 0) {
                // If history length is increased, we should pushState
                // Note that path might not actually change here, for example, drawer open should pushState
    -@@ -422,7 +463,8 @@ export function useLinking(ref, {
    +@@ -422,7 +466,8 @@ export function useLinking(ref, {
                // If history length is decreased, i.e. entries were removed, we want to go back
      
                const nextIndex = history.backIndex({
    @@ -159,7 +171,7 @@ index af0cd61..fb06350 100644
                });
                const currentIndex = history.index;
                try {
    -@@ -435,7 +477,18 @@ export function useLinking(ref, {
    +@@ -435,7 +480,18 @@ export function useLinking(ref, {
                    // We couldn't find an existing entry to go back to, so we'll go back by the delta
                    // This won't be correct if multiple routes were pushed in one go before
                    // Usually this shouldn't happen and this is a fallback for that
    @@ -179,7 +191,7 @@ index af0cd61..fb06350 100644
                  }
      
                  // Store the updated state as well as fix the path if incorrect
    -@@ -448,10 +501,26 @@ export function useLinking(ref, {
    +@@ -448,10 +504,26 @@ export function useLinking(ref, {
                }
              } else {
                // If history length is unchanged, we want to replaceState
    diff --git a/patches/react-navigation/details.md b/patches/react-navigation/details.md
    index 54272192681..262472ca5cb 100644
    --- a/patches/react-navigation/details.md
    +++ b/patches/react-navigation/details.md
    @@ -42,6 +42,7 @@
     - PR Introducing Patch: [#24165](https://github.com/Expensify/App/pull/24165)
     - PR Updating Patch: [#32087](https://github.com/Expensify/App/pull/32087) [#42465](https://github.com/Expensify/App/pull/42465) [#64155](https://github.com/Expensify/App/pull/64155) [#103346](https://github.com/Expensify/App/pull/103346) [#101715](https://github.com/Expensify/App/issues/101715)
     - Note: Re-ported onto 7.4.1. `createMemoryHistory` and `useLinking` were refactored upstream (`getPathWithoutHash`, `getHistoryLength`, `pendingPopStateDelta`, `isPoppingLastEntry`), so the hunks were re-anchored instead of applied verbatim: `backIndex` keeps upstream's hash handling and adds the focused-route-key match, and `useLinking` keeps upstream's `pendingPopStateDelta` guard and `getHistoryLength` delta while re-adding `historyDeltaByKeys`/`getStaleHistoryDiff`. Two parts of the old patch became redundant and were dropped: the `findFocusedRouteKey` helper file now matches upstream's own module, and the extra `history.replace` right after `history.go(nextIndex - currentIndex)` duplicated the replace that upstream already runs at the end of the same `try` block.
    +- Note: The `popstate` listener skips upstream's `isPoppingLastEntry` → `GO_BACK` shortcut when the last root history entry is a custom string entry (e.g. a `useSyncModalWithHistory` back-guard). No router can pop such an entry with `GO_BACK`, so it falls back to `resetRoot(record.state)` (the pre-7.3 behavior), which drops the entry and lets the modal close on browser Back.
     
     ### [@react-navigation+stack+7.11.2+001+edge-drag-gesture.patch](@react-navigation+stack+7.11.2+001+edge-drag-gesture.patch)
     
    
    
  11. TMisiukiewicz commented on Oct 16, 2026

    @TMisiukiewicz
    Contributor

    Thanks @ZhenjaHorbach your patch looks good and fixes the issue, opened #104190 and will upstream it to React Navigation 🙏

  12. cristipaval commented on Oct 16, 2026

    @cristipaval
    Contributor
  13. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Oct 16, 2026
  14. changed the title [-]Web- Browser back button doesn't dismiss "You appear to be offline" alert[/-] [+][Due for payment 2026-10-27] Web- Browser back button doesn't dismiss "You appear to be offline" alert[/+] on Oct 20, 2026
  15. melvin-bot commented on Oct 20, 2026

    @melvin-bot

    @ZhenjaHorbach

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.14-3 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-10-27. 🎊

    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]

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.DailyKSv2EngineeringOverdue

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions