Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[$250] mWeb - Onboarding - Onboarding can be dismissed with device back button and website freezes #54473

Open
1 of 8 tasks
vincdargento opened this issue Dec 23, 2024 · 12 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@vincdargento
Copy link

vincdargento commented Dec 23, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.77-6
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 - Android 12 - Chrome
App Component: Other

Action Performed:

  1. Open the staging.new.expensify.com website.
  2. Sign in with a new account.
  3. When the onboarding modal is displayed, use device back button twice or more times if necessary.

Expected Result:

Onboarding modal shouldn´t be dismissed when using device back button.

Actual Result:

Onboarding modal is dismissed after using device back button and the website freezes on inbox after this action.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021872156796368987725
  • Upwork Job ID: 1872156796368987725
  • Last Price Increase: 2024-12-26
Issue OwnerCurrent Issue Owner: @rushatgabhane
@vincdargento vincdargento added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. DeployBlocker Indicates it should block deploying the API labels Dec 23, 2024
Copy link

melvin-bot bot commented Dec 23, 2024

Triggered auto assignment to @MitchExpensify (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.

@Shahidullah-Muffakir
Copy link
Contributor

Shahidullah-Muffakir commented Dec 24, 2024

Edited by proposal-police: This proposal was edited at 2024-12-24 01:39:35 UTC.

Proposal

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

The issue occurs when a user is on the onboarding screen, and the onboarding modal is dismissed after pressing the device back button.

What is the root cause of that problem?

We did not handle the back button in the onboarding flow in the web, and as a result, the device back button press triggers the dismissal of the onboarding modal.
The code is added only for native:

// To block android native back button behavior

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

To resolve this issue, we should intercept the back button press while the onboarding modal is displayed. This can be done by using the same code as use in the native for web as well
in the

function OnboardingPurpose({...rest}: OnboardingPurposeProps) {

add the same code:

    // To block android native back button behavior
    useFocusEffect(
        useCallback(() => {
            // Return true to indicate that the back button press is handled here
            const backAction = () => true;

            const backHandler = BackHandler.addEventListener('hardwareBackPress', backAction);

            return () => backHandler.remove();
        }, []),
    );

We may need to apply a similar change in the OnboardingEmployees if the signupQualifier is VSB, because the BaseOnboardingPurpose is skipped when the signupQualifier is VSB.

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

NA

@samranahm
Copy link

@Shahidullah-Muffakir

Event listeners like BackHandler.addEventListener work only in the native environment and will not have any effect on the web.

@techievivek
Copy link
Contributor

Removing the blocker label since it's related to frontend only.

@melvin-bot melvin-bot bot added the Overdue label Dec 26, 2024
@techievivek techievivek removed Overdue DeployBlocker Indicates it should block deploying the API labels Dec 26, 2024
@techievivek techievivek added the External Added to denote the issue can be worked on by a contributor label Dec 26, 2024
Copy link

melvin-bot bot commented Dec 26, 2024

Job added to Upwork: https://www.upwork.com/jobs/~021872156796368987725

@melvin-bot melvin-bot bot changed the title mWeb - Onboarding - Onboarding can be dismissed with device back button and website freezes [$250] mWeb - Onboarding - Onboarding can be dismissed with device back button and website freezes Dec 26, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 26, 2024
Copy link

melvin-bot bot commented Dec 26, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Dec 26, 2024
@railway17
Copy link
Contributor

Proposal

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

The issue occurs when a user is on the onboarding screen, and the onboarding modal is dismissed after pressing the device back button.

What is the root cause of that problem?

We did not handle the back button pressing event for the web,

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

  • We have to add a new handler to prevent the pressing back button.
  • It can be implemented by creating a new custom hook which will be created inside src/hooks/usePreventBackNavigation.ts.
  • We can use this hook in BaseOnboardingPurpose component.

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

N/A

@Senninseyi
Copy link

Proposal


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

The onboarding modal on Expensify’s mWeb interface is dismissed when the back button is pressed, causing the website to freeze on the inbox page.

What is the root cause of that problem?

  • The back button event is not correctly handled, allowing unintended modal dismissal.

  • State management fails to maintain stability after the modal is dismissed.

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

  1. Add a listener to prevent the default back button action when the onboarding modal is active.

  2. Ensure the application state remains consistent if a back button action occurs during onboarding.

  3. Fix transitions and cleanup to avoid app freezes when dismissals occur improperly.

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

NA

Copy link

melvin-bot bot commented Dec 27, 2024

📣 @Senninseyi! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@Senninseyi
Copy link

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01bdedaf1b63d8c485?mp_source=share

Copy link

melvin-bot bot commented Dec 27, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@ikevin127
Copy link
Contributor

BackHandler only works on native as the documentation page states:

Warning

Warning for modal users:
If your app shows an opened Modal, BackHandler will not publish any events (see Modal docs).

given that on narrow layout devices we display stack navigator screens like OnboardingPurpose as modal (see OnboardingModalNavigator).

To further reinforce this point, here's a commit c87e7d1: fix BackHandler is not supported on web and should not be used. error where we applied a patch in react-native-modal to fix an error which would state that BackHandler is not supported on web.

I spent some time trying to consistently reproduce the issue and was not able to on Android: mWeb Chrome, since most of the times if I press the hardware back button, it usually either goes back to empty page (no URL) or it closes the browser app altogether, then when I reopen it and navigate to the app, only then, in some cases I will be stuck on home page which is frozen with URL being /onboarding/purpose.

android.webm

I think we need more datailed steps in order to consistently reproduce the issue as without that we cannot properly debug and propose a fix, it'd only be guesswork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

9 participants