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

Onboarding - Pressing enter after selecting company size and connections does not work #55457

Open
1 of 8 tasks
lanitochka17 opened this issue Jan 19, 2025 · 6 comments
Open
1 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Jan 19, 2025

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.87
Reproducible in staging?: Y
Reproducible in production?: Y
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
Issue reported by: Applause - Internal Team

Action Performed:

  1. Sign in to staging.new.expensify.com with a new account
  2. On the onboarding modal click on "Manage my team's expense"
  3. In the "How many employees do you have" prompt, select any size and press enter on Keyboard

Expected Result:

The onboarding modal moves to the next page, "Do you use any accounting software?"

Actual Result:

When pressing enter after selecting a size and accounting software the modal does not move to the next page

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

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

Screenshots/Videos

Add any screenshot/video evidence
Bug6718131_1737292631049.bandicam_2025-01-19_15-52-39-619.mp4

View all open jobs on GitHub

@lanitochka17 lanitochka17 added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Jan 19, 2025
Copy link

melvin-bot bot commented Jan 19, 2025

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

Proposal

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

When pressing Enter key in the accounting and employees page, the user is not going to the next page.

What is the root cause of that problem?

The Button component has a pressOnEnter prop that should handle the Enter key press, but it's not working because:
The button isn't receiving focus after users make a selection

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

  1. Add a reference to the Continue button using useRef

    ref={continueButtonRef}
  2. Add a useEffect hook that focuses the Continue button whenever a user makes a selection
    const continueButtonRef = useRef<NodeJS.Timeout | null>(null);

    // Focus the continue button when a selection is made
    useEffect(() => {
        if (userReportedIntegration !== undefined && continueButtonRef.current) {
            continueButtonRef.current.focus();
        }
    }, [userReportedIntegration]);
  1. Keep the button focused until the user either clicks it or presses Enter

Do the same for BaseOnboardingEmployees as well, because the page has the same issue

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

NA

What alternative solutions did you explore? (Optional)

NA

Screen.20Recording.202025-01-19.20at.208-2.mp4

@Shahidullah-Muffakir
Copy link
Contributor

We can combine it with this issue #55145

@mkzie2
Copy link
Contributor

mkzie2 commented Jan 20, 2025

Proposal

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

When pressing enter after selecting a size and accounting software the modal does not move to the next page

What is the root cause of that problem?

When we select an option, we sync the focus, which causes the confirm button to be blurred and the enter key to not work.

useSyncFocus(pressableRef, !!isFocused, shouldSyncFocus);

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

Define a new prop in SelectionList is shouldSyncFocus with the default value is true, and update the condition to sync the focus here

shouldSyncFocus={!isTextInputFocusedRef.current && shouldSyncFocus && !showConfirmButton} 

shouldSyncFocus={!isTextInputFocusedRef.current}

Then we can pass this prop as false for each page that has the button with the enter key subscribe and will not navigate after selecting an option

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

NA

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jan 20, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-01-20 03:53:58 UTC.

Proposal

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

Onboarding - Pressing enter after selecting company size and connections does not work

What is the root cause of that problem?

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

  • I think storing the company size state in a component is useless and it also makes this list option selection different from any other selection list. In every selection list, we select the option and proceed if the option is pressed or clicked but in these components we only select the option.
  • First we should remove the selectedCompanySize state and replace all instance of selectedCompanySize with onboardingCompanySize.
    const [onboardingCompanySize] = useOnyx(ONYXKEYS.ONBOARDING_COMPANY_SIZE);

    const [selectedCompanySize, setSelectedCompanySize] = useState<OnboardingCompanySize | null | undefined>(onboardingCompanySize);
  • Then we should create a new function onConfirm which will contain all the logic passed to onPress prop of the button. Additionally this function will accept a prop companySize?: OnboardingCompanySize and we will replace all instance of selectedCompanySize in the function with companySize parameter.
    onPress={() => {
    if (!selectedCompanySize) {
    setError(translate('onboarding.errorSelection'));
    return;
    }
    Welcome.setOnboardingCompanySize(selectedCompanySize);
    const shouldCreateWorkspace = !onboardingPolicyID && !paidGroupPolicy;
    // We need `adminsChatReportID` for `Report.completeOnboarding`, but at the same time, we don't want to call `Policy.createWorkspace` more than once.
    // If we have already created a workspace, we want to reuse the `onboardingAdminsChatReportID` and `onboardingPolicyID`.
    const {adminsChatReportID, policyID} = shouldCreateWorkspace
    ? Policy.createWorkspace(undefined, true, '', Policy.generatePolicyID(), CONST.ONBOARDING_CHOICES.MANAGE_TEAM)
    : {adminsChatReportID: onboardingAdminsChatReportID, policyID: onboardingPolicyID};
    if (shouldCreateWorkspace) {
    Welcome.setOnboardingAdminsChatReportID(adminsChatReportID);
    Welcome.setOnboardingPolicyID(policyID);
    }
    // For MICRO companies (1-10 employees), we want to remain on NewDot.
    if (!NativeModules.HybridAppModule || selectedCompanySize === CONST.ONBOARDING_COMPANY_SIZE.MICRO) {
    Navigation.navigate(ROUTES.ONBOARDING_ACCOUNTING.getRoute(route.params?.backTo));
    return;
    }
    // For other company sizes we want to complete onboarding here.
    // At this point `onboardingPurposeSelected` should always exist as we set it in `BaseOnboardingPurpose`.
    if (onboardingPurposeSelected) {
    Report.completeOnboarding(
    onboardingPurposeSelected,
    CONST.ONBOARDING_MESSAGES[onboardingPurposeSelected],
    undefined,
    undefined,
    adminsChatReportID,
    onboardingPolicyID,
    undefined,
    onboardingCompanySize,
    );
    }
    NativeModules.HybridAppModule.closeReactNativeApp(false, true);
    }}
  • We will then update the onPress prop of the Button to onPress={() => onConfirm(onboardingCompanySize)}.
  • And lastly we will update onSelectRow to:
                onSelectRow={(item) => {
                    onConfirm(item.keyForList);
                    setError('');
                }}
  • Similar change will we also required in the other component.

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

NA

What alternative solutions did you explore? (Optional)

Result

Monosnap.screencast.2025-01-20.09-21-15.mp4

Copy link
Contributor

⚠️ @Krishna2323 Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).

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
Projects
None yet
Development

No branches or pull requests

5 participants