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

Profile - Phone number field is not auto focused #53030

Open
2 of 8 tasks
IuliiaHerets opened this issue Nov 23, 2024 · 4 comments
Open
2 of 8 tasks

Profile - Phone number field is not auto focused #53030

IuliiaHerets opened this issue Nov 23, 2024 · 4 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@IuliiaHerets
Copy link

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:

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

Screenshots/Videos

Bug6673771_1732326370020.23.11.2024_04.31.34_REC.mp4

View all open jobs on GitHub

@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 23, 2024
Copy link

melvin-bot bot commented Nov 23, 2024

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
Copy link
Contributor

ChavdaSachin commented Nov 23, 2024

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.

<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}
onBlur={() => {
if (!validateLoginError) {
return;
}
PersonalDetails.clearPhoneNumberError();
}}
/>

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

Pass autoFocus prop here.

<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}
onBlur={() => {
if (!validateLoginError) {
return;
}
PersonalDetails.clearPhoneNumberError();
}}
/>

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
Copy link
Contributor

NJ-2020 commented Nov 23, 2024

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

<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}
onBlur={() => {
if (!validateLoginError) {
return;
}
PersonalDetails.clearPhoneNumberError();
}}
/>

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

ref={inputCallbackRef}

and here

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
Copy link
Contributor

huult commented Nov 24, 2024

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:

<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}
onBlur={() => {
if (!validateLoginError) {
return;
}
PersonalDetails.clearPhoneNumberError();
}}
/>

Legal name:

<InputWrapper
InputComponent={TextInput}
inputID={INPUT_IDS.LEGAL_FIRST_NAME}
name="lfname"
label={translate('privatePersonalDetails.legalFirstName')}
aria-label={translate('privatePersonalDetails.legalFirstName')}
role={CONST.ROLE.PRESENTATION}
defaultValue={legalFirstName}
spellCheck={false}
/>

Address still does not autofocus, but since it uses a different component, we can report and update it later

<InputWrapper
InputComponent={AddressSearch}
inputID={INPUT_IDS.ADDRESS_LINE_1}
label={translate('common.addressLine', {lineNumber: 1})}
onValueChange={(data: unknown, key: unknown) => {
onAddressChanged(data, key);
}}
defaultValue={street1}
renamedInputKeys={{
street: INPUT_IDS.ADDRESS_LINE_1,
street2: INPUT_IDS.ADDRESS_LINE_2,
city: INPUT_IDS.CITY,
state: INPUT_IDS.STATE,
zipCode: INPUT_IDS.ZIP_POST_CODE,
country: INPUT_IDS.COUNTRY as Country,
}}
maxInputLength={CONST.FORM_CHARACTER_LIMIT}
shouldSaveDraft={shouldSaveDraft}
/>

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:

<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}
onBlur={() => {
if (!validateLoginError) {
return;
}
PersonalDetails.clearPhoneNumberError();
}}
/>

      autoFocus
      shouldDelayFocus={shouldDelayFocus}

Legal name:

<InputWrapper
InputComponent={TextInput}
inputID={INPUT_IDS.LEGAL_FIRST_NAME}
name="lfname"
label={translate('privatePersonalDetails.legalFirstName')}
aria-label={translate('privatePersonalDetails.legalFirstName')}
role={CONST.ROLE.PRESENTATION}
defaultValue={legalFirstName}
spellCheck={false}
/>

      autoFocus
      shouldDelayFocus={shouldDelayFocus}
POC
Screen.Recording.2024-11-24.at.22.18.28.mov

What alternative solutions did you explore? (Optional)

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