You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2025-08-26] [BACK BUTTON] [$250] Sign In - App closes when tapped on device back button on "Enter magic code" screen #67883
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorMonthlyKSv2Not a priorityReviewingHas a PR in review
Version Number: 9.1.89-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail: Exploratory Email or phone of affected tester (no customers):applausetester+omqq1@applause.expensifail.com Issue reported by: Applause Internal Team Device used: Pixel 6/Android 16 App Component: User Settings
Action Performed:
Precondition: user signed out
Open app
Write any registered email and tap on "Next" button
Tap device back button to close keyboard
Tap again device back button to navigate to previous page
Expected Result:
User should be navigated to previous screen "Enter your email"
Actual Result:
App closes when tapped on device back button on "Enter magic code" screen
Please re-state the problem that we are trying to solve in this issue.
Sign In - App closes when tapped on device back button on "Enter magic code" screen
What is the root cause of that problem?
The code input is not using a different page than the base signin page, it's just overlayed above the email input page, so using device back button closes the app:
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
N/A
What alternative solutions did you explore? (Optional)
We can use useBeforeRemove hook to listen for beforeRemove and pass navigateBack to it. Or we can combine both.
If we also want to handle this on web/mweb then we need to do listen for window.addEventListener('popstate') just like we do in Modal,
This is just pseudocode, we should also check for other state of the for like, we do in the navigateBack and only add the listener when the email input is not visible (any other component is visible, e.g. UnlinkLoginForm, ChooseSSOOrMagicCode.) We can use useEffect hook to remove and add the listener.
changed the title [-]Sign In - App closes when tapped on device back button on "Enter magic code" screen[/-][+][$250] Sign In - App closes when tapped on device back button on "Enter magic code" screen[/+]on Aug 11, 2025
Thanks @Krishna2323. I think that's fine to handle it for Android only.
If we use the browser history popState solution, it can lead to forward browser button doing nothing after we press browser go back button because we push an empty state onto it. I used to experience the same case while working on this TestToolModal bug, we later decided to migrate it to Modal Screen.
Hello assignees. We came to the conclusion in #57969 that the back buttons in the app behave inconsistently and in a way that we don't think is ideal, but that fixing the issue is a potentially high cost, low reward situation. We are going to start tracking these issues and attempt to find a way and somebody who can help solve this problem heuristically across the app.
I have HELD a lot of issues related to the "back button" but any that are currently Reviewing or Due for payment I have not held. If you believe your issue shouldn't be linked or HELD, comment with the explanation and I will review and unlike/remove the hold. Thank you!
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorMonthlyKSv2Not a priorityReviewingHas a PR in review
Activity
melvin-bot commentedon Aug 5, 2025
Triggered auto assignment to @muttmuure (
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.Krishna2323 commentedon Aug 5, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Sign In - App closes when tapped on device back button on "Enter magic code" screen
What is the root cause of that problem?
App/src/pages/signin/SignInPage.tsx
Lines 332 to 339 in 3c1d3c5
What changes do you think we should make in order to solve the problem?
useHandleBackButtonand passnavigateBackfor the parameter.App/src/pages/signin/SignInPage.tsx
Lines 285 to 301 in 3c1d3c5
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
N/A
What alternative solutions did you explore? (Optional)
We can use
useBeforeRemovehook to listen forbeforeRemoveand passnavigateBackto it. Or we can combine both.If we also want to handle this on web/mweb then we need to do listen for
window.addEventListener('popstate')just like we do in Modal,This is just pseudocode, we should also check for other state of the for like, we do in the
navigateBackand only add the listener when the email input is not visible (any other component is visible, e.g.UnlinkLoginForm,ChooseSSOOrMagicCode.) We can useuseEffecthook to remove and add the listener.Result
Monosnap.screencast.2025-08-05.16-12-49.mp4
Monosnap.screencast.2025-08-05.17-01-30.mp4
melvin-bot commentedon Aug 8, 2025
@muttmuure Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Aug 11, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021955039225588208628
[-]Sign In - App closes when tapped on device back button on "Enter magic code" screen[/-][+][$250] Sign In - App closes when tapped on device back button on "Enter magic code" screen[/+]melvin-bot commentedon Aug 11, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hungvu193 (
External)hungvu193 commentedon Aug 12, 2025
Thanks @Krishna2323. I think that's fine to handle it for Android only.
If we use the browser history popState solution, it can lead to forward browser button doing nothing after we press browser go back button because we push an empty state onto it. I used to experience the same case while working on this TestToolModal bug, we later decided to migrate it to Modal Screen.
Let's move forward with your main solution
🎀 👀 🎀
31 remaining items
twisterdotcom commentedon Sep 11, 2025
Hello assignees. We came to the conclusion in #57969 that the back buttons in the app behave inconsistently and in a way that we don't think is ideal, but that fixing the issue is a potentially high cost, low reward situation. We are going to start tracking these issues and attempt to find a way and somebody who can help solve this problem heuristically across the app.
I have HELD a lot of issues related to the "back button" but any that are currently
ReviewingorDue for paymentI have not held. If you believe your issue shouldn't be linked or HELD, comment with the explanation and I will review and unlike/remove the hold. Thank you!hungvu193 commentedon Sep 12, 2025
Hi @twisterdotcom This issue was due for payment since Aug 26th
twisterdotcom commentedon Sep 12, 2025
@muttmuure is this all paid out now?
muttmuure commentedon Sep 12, 2025
@hungvu193 is also owed payment via NewDot, sorry I blitzed through all of these yesterday and didn't catch it
muttmuure commentedon Sep 12, 2025
@hungvu193 did you request payment already?
hungvu193 commentedon Sep 12, 2025
I did. Feel free to close
JmillsExpensify commentedon Sep 16, 2025
$250 approved for @hungvu193
quinthar commentedon Sep 17, 2025
Approved $250 for @Krishna2323
melvin-bot commentedon Oct 13, 2025
This issue has not been updated in over 15 days. @hungvu193, @lakchote, @muttmuure, @Krishna2323 eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
melvin-bot commentedon Dec 10, 2025
@hungvu193, @lakchote, @muttmuure, @Krishna2323, this Monthly task hasn't been acted upon in 6 weeks; closing.
If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.