Skip to content

[HOLD][$250] Bank account - Tapping device back button directs user to "where's your bank account located" page #84015

Closed

Description

@jponikarchuk

Version Number: V9.3.28-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #81333
Email or phone of affected tester (no customers): dreamnitethedragon@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Redminote 10S Android 13
App Component: User Settings

Action Performed:

  1. Launch app
  2. Go to wallet
  3. Make payments - united states - region bank
  4. Complete the flow until "let's double check" page
  5. Tap top arrow
  6. Tap device back button

Expected Result:

Tapping device back button must direct user to previous page.

Actual Result:

Tapping top arrow navigates back to previous page and tapping device back button directs user to "where's your bank account located" page.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @arosiclair
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022028777977730866149
  • Upwork Job ID: 2028777977730866149
  • Last Price Increase: 2026-03-03

Activity

  1. added
    InternalRequires API changes or must be handled by Expensify staff
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 3, 2026
  2. melvin-bot commented on Mar 3, 2026

    @melvin-bot

    Triggered auto assignment to @bfitzexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. MelvinBot commented on Mar 3, 2026

    @MelvinBot
    Contributor

    Proposal

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

    When a user is in the US bank account setup flow (Wallet → Add Bank Account → select US → choose Plaid/Manual → go through substeps until the "Let's double check" confirmation page), tapping the header back arrow correctly navigates to the previous substep, but pressing the device back button (Android hardware button or browser back) incorrectly jumps all the way back to the "Where's your bank account located?" country selection page, skipping all intermediate substeps.

    What is the root cause of that problem?

    The PersonalInfoPage component (PersonalInfo.tsx:24-96) manages its substeps (PlaidBankAccount/ManualBankAccount → LegalName → Address → PhoneNumber → Confirmation) using the deprecated useSubStep hook, which tracks the current step purely via React state (screenIndex) rather than pushing navigation routes.

    The component defines a correct handleBackButtonPress function (lines 71-81) that decrements the substep index, but this handler is only connected to the header back arrow via InteractiveStepWrapper → HeaderWithBackButton.onBackButtonPress. There is no useAndroidBackButtonHandler call to intercept the hardware/browser back button.

    When the device back button is pressed:

    • On Android: React Navigation's default goBack() fires (no BackHandler listener intercepts it), which pops the entire SETTINGS_ADD_US_BANK_ACCOUNT screen from the navigation stack
    • On Web (Chrome): The browser navigates back in its history, but since useSubStep doesn't push routes for substep changes, there are no history entries for the intermediate steps

    In both cases, the user lands on the previous screen in the navigation stack — the country selection page.

    For comparison, the non-US bank account flow (InternationalDepositAccountContent.tsx) correctly handles this by calling useAndroidBackButtonHandler(handleBackButtonPress) and using the newer useSubPage hook which pushes actual routes for each substep.

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

    Add useAndroidBackButtonHandler to PersonalInfoPage (PersonalInfo.tsx) to intercept the hardware/device back button, similar to how InternationalDepositAccountContent.tsx does it:

    1. Import useAndroidBackButtonHandler from @hooks/useAndroidBackButtonHandler
    2. Modify handleBackButtonPress to return a boolean (true to prevent default navigation behavior)
    3. Call useAndroidBackButtonHandler(handleBackButtonPress) inside the component

    This ensures the device back button calls the same logic as the header back arrow — decrementing the substep index instead of popping the entire screen.

    Note: BankAccountPurposePage (index.tsx) has the same pattern (manages substeps via useState without BackHandler registration) and should also be fixed.

    What alternative solutions did you explore? (Optional)

    The longer-term solution would be to migrate PersonalInfoPage from the deprecated useSubStep hook to the newer useSubPage hook (per issue #79039), which uses actual navigation routes for each substep. This would make the back button work correctly by default since each substep would have its own entry in the navigation stack/browser history. However, adding useAndroidBackButtonHandler is the minimal fix that addresses the immediate bug.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Mar 3, 2026
  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 3, 2026
  6. melvin-bot commented on Mar 3, 2026

    @melvin-bot

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

  7. changed the title [-]Bank account - Tapping device back button directs user to "where's your bank account located" page[/-] [+][$250] Bank account - Tapping device back button directs user to "where's your bank account located" page[/+] on Mar 3, 2026
  8. melvin-bot commented on Mar 3, 2026

    @melvin-bot
  9. twilight2294 commented on Mar 3, 2026

    @twilight2294
    Contributor

    Proposal

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

    When a user is in the US bank account setup flow and reaches the "Let's double check" confirmation page (or any substep within PersonalInfo), tapping the device back button (Android hardware button or browser back gesture) incorrectly navigates all the way back to the "Where's your bank account located?" country selection page, skipping all intermediate substeps. However, tapping the header back arrow correctly navigates to the previous substep.

    What is the root cause of that problem?

    The PersonalInfo() function in PersonalInfo manages substeps (FullName → DateOfBirth → SocialSecurityNumber → Address → Confirmation) through local component state rather than pushing actual navigation routes. The component defines a handleBackButtonPress() function that correctly decrements the substep index, but this handler is only connected to the header back arrow via InteractiveStepWrapper's onBackButtonPress prop.

    When the device back button is pressed, React Navigation's beforeRemove event fires, attempting to navigate away from the entire REIMBURSEMENT_ACCOUNT_ROOT screen. Since there's no custom handler intercepting this event, React Navigation's default behavior executes, which pops the entire screen from the navigation stack and returns to the previous screen (the country selection page). The substep state changes don't create navigation history entries, so the intermediate substeps are effectively invisible to the navigation system.

    The codebase already has the useBeforeRemove hook pattern for handling this exact scenario (intercepting hardware back navigation to call custom handlers instead of default navigation behavior). This pattern just needs to be applied to PersonalInfo, BusinessInfo, BankInfo, and BeneficialOwnersStep — all components that use substeps within the ReimbursementAccount flow.

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

    Add the useBeforeRemove hook to intercept the device back button in PersonalInfo:

    import {useCallback} from 'react';
    import useBeforeRemove from '@hooks/useBeforeRemove';
    
    function PersonalInfo({onBackButtonPress, ref}: PersonalInfoProps) {
        // ... existing code ...
        
        const handleBackButtonPress = useCallback(() => {
            if (isEditing) {
                goToTheLastStep();
                return;
            }
    
            if (screenIndex === 0) {
                onBackButtonPress();
            } else {
                prevScreen();
            }
        }, [isEditing, screenIndex, goToTheLastStep, onBackButtonPress, prevScreen]);
    
        // Intercept hardware back button
        useBeforeRemove(
            useCallback(
                (e) => {
                    // Only intercept if we're not on the first substep
                    if (screenIndex === 0 && !isEditing) {
                        return;
                    }
                    
                    e.preventDefault();
                    handleBackButtonPress();
                },
                [screenIndex, isEditing, handleBackButtonPress],
            ),
        );
    
        // ... rest of code ...
    }

    Apply the same fix to BusinessInfo, BankInfo, and BeneficialOwnersStep.

    What alternative solutions did you explore? (Optional)

    The existing proposal from MelvinBot suggests using useAndroidBackButtonHandler, which only works on Android. The useBeforeRemove hook is superior because it intercepts React Navigation's beforeRemove event, which fires for both Android hardware back buttons and browser back gestures on web, providing a cross-platform solution. This is the established pattern already used elsewhere in the codebase for handling back navigation in substep flows.

  10. self-assigned this
    on Mar 6, 2026
  11. 4 remaining items

  12. arosiclair commented on Mar 9, 2026

    @arosiclair
    Contributor

    Not overdue

  13. zscy0710 commented on Mar 10, 2026

    @zscy0710

    Proposal

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

    In add-bank-account substeps, device/browser back should follow immediate previous step and not jump to earlier country-selection state.

    What is the root cause of that problem?

    Substep history handling can become inconsistent between header-back and device/browser-back interactions.

    What changes did you make to solve the problem?

    • Kept substep back behavior aligned with standard subpage navigation handling.
    • Removed the replace-on-prev variant that could create duplicate-history confusion.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    • Header back then device/browser back behaves as one-step progression.
    • No duplicate-step bounce in substep navigation stack.
  14. changed the title [-][$250] Bank account - Tapping device back button directs user to "where's your bank account located" page[/-] [+][HOLD][$250] Bank account - Tapping device back button directs user to "where's your bank account located" page[/+] on Mar 10, 2026
  15. melvin-bot commented on Mar 12, 2026

    @melvin-bot

    @arosiclair Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  16. bernhardoj commented on Mar 13, 2026

    @bernhardoj
    Contributor

    @jponikarchuk can we retest this? Thanks!

  17. arosiclair commented on Mar 13, 2026

    @arosiclair
    Contributor

    Requested a retest here

  18. IuliiaHerets commented on Mar 13, 2026

    @IuliiaHerets

    @arosiclair not repro on Web (Windows 10/Chrome) and Android (Galaxy A55 / Android 16), v9.3.37-0

    repro.-.issue.84015.android.mp4
    repro.-.issue.84015.1.mp4
  19. arosiclair commented on Mar 13, 2026

    @arosiclair
    Contributor

    Thanks, closing this

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions