Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.57k stars 2.91k forks source link

Profile - Phone number field is not auto focused #53030

Open IuliiaHerets opened 1 day ago

IuliiaHerets commented 1 day ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.0.66-0 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): gibethlehem@gmail.com Issue reported by: Applause Internal Team

Action Performed:

  1. Login to an account
  2. Go to Settings > Profile > Private
  3. Click on the Phone number.

Expected Result:

The phone number field is auto-focused.

Actual Result:

The phone number field is not auto-focused. The same behavior with the Legal name and Address pages.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/32c5569b-7850-49bb-9339-b29a96c50efd

View all open jobs on GitHub

melvin-bot[bot] commented 1 day ago

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

ChavdaSachin commented 1 day ago

Edited by proposal-police: This proposal was edited at 2024-11-23 18:08:13 UTC.

Proposal

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

Profile - Phone number field is not auto focused

What is the root cause of that problem?

autoFocus prop is not passed here. https://github.com/Expensify/App/blob/3ebe8520d74c57a2fe9548b7d4307206e2b7c673/src/pages/settings/Profile/PersonalDetails/PhoneNumberPage.tsx#L96-L111

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

Pass autoFocus prop here. https://github.com/Expensify/App/blob/3ebe8520d74c57a2fe9548b7d4307206e2b7c673/src/pages/settings/Profile/PersonalDetails/PhoneNumberPage.tsx#L96-L111

Additionally we should check on other similar pages and and fix there too.

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.

NJ-2020 commented 1 day ago

Proposal

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

Profile - Phone number field is not auto focused

What is the root cause of that problem?

We are not focusing the input here https://github.com/Expensify/App/blob/3ebe8520d74c57a2fe9548b7d4307206e2b7c673/src/pages/settings/Profile/PersonalDetails/PhoneNumberPage.tsx#L96-L111

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

We can use useAutoFocusInput to focus the input same like what we do here https://github.com/Expensify/App/blob/3ebe8520d74c57a2fe9548b7d4307206e2b7c673/src/pages/GroupChatNameEditPage.tsx#L110 and here https://github.com/Expensify/App/blob/3ebe8520d74c57a2fe9548b7d4307206e2b7c673/src/pages/iou/request/step/IOURequestStepMerchant.tsx#L136

const {inputCallbackRef} = useAutoFocusInput();

<InputWrapper
    InputComponent={TextInput}
    inputID={INPUT_IDS.PHONE_NUMBER}
    name="lfname"
    label={translate('common.phoneNumber')}
    aria-label={translate('common.phoneNumber')}
    role={CONST.ROLE.PRESENTATION}
    defaultValue={phoneNumber}
    spellCheck={false}
    // inputCallbackRef
    ref={inputCallbackRef}
    onBlur={() => {
        if (!validateLoginError) {
            return;
        }
        PersonalDetails.clearPhoneNumberError();
    }}
/>

What alternative solutions did you explore? (Optional)

huult commented 16 hours ago

Proposal

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

Profile - Phone number field is not auto focused

What is the root cause of that problem?

We do not handle autofocus for private profile fields such as phone number, legal name, and address.

Phone number: https://github.com/Expensify/App/blob/e532ef12a3becf621212a64b4dc177ad3fd42a63/src/pages/settings/Profile/PersonalDetails/PhoneNumberPage.tsx#L96-L111

Legal name: https://github.com/Expensify/App/blob/44b2f77bf8da76724c22d7e54cc1c220fa6bc798/src/pages/settings/Profile/PersonalDetails/LegalNamePage.tsx#L101-L110

Address still does not autofocus, but since it uses a different component, we can report and update it later https://github.com/Expensify/App/blob/2c27e6310684fe9cbabf3f1a67291b581be70229/src/components/AddressForm.tsx#L148-L166

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

To resolve this, we will add autofocus to enable autofocus and shouldDelayFocus={shouldDelayFocus} to smoothly open the keyboard on Android as props of InputWrapper.

Phone number: https://github.com/Expensify/App/blob/e532ef12a3becf621212a64b4dc177ad3fd42a63/src/pages/settings/Profile/PersonalDetails/PhoneNumberPage.tsx#L96-L111

      autoFocus
      shouldDelayFocus={shouldDelayFocus}

Legal name: https://github.com/Expensify/App/blob/44b2f77bf8da76724c22d7e54cc1c220fa6bc798/src/pages/settings/Profile/PersonalDetails/LegalNamePage.tsx#L101-L110

      autoFocus
      shouldDelayFocus={shouldDelayFocus}
POC https://github.com/user-attachments/assets/292db358-735a-4bde-8063-f82d33c24ab3

What alternative solutions did you explore? (Optional)