App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Routing number field doesn't get auto focused after opening the page reported by @Puneet-here

Open kavimuru opened this issue 2 years ago • 51 comments

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


Action Performed:

  1. Navigate to settings > workspace > connect bank account
  2. Connect manually

Expected Result:

Routing number field should get focused

Actual Result:

It doesn't get focused

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number: 1.2.9-0 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos:

https://user-images.githubusercontent.com/43996225/193083990-640a22f3-a01b-44f2-93be-303bcda6cd3b.MP4

Expensify/Expensify Issue URL: Issue reported by: @Puneet-here Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1663687968571139

View all open jobs on GitHub

kavimuru avatar Sep 29 '22 16:09 kavimuru

Triggered auto assignment to @zanyrenney (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

melvin-bot[bot] avatar Sep 29 '22 16:09 melvin-bot[bot]

Proposal

We can use autoFocus here https://github.com/Expensify/App/blob/7c29d89afe94b8e2f178e55b8f0137c91b1283c8/src/pages/ReimbursementAccount/BankAccountManualStep.js#L116

Puneet-here avatar Sep 29 '22 16:09 Puneet-here

I can't repro this, but from the video, it looks good for eng triage and the solution above seems like a good one!

zanyrenney avatar Sep 29 '22 16:09 zanyrenney

Triggered auto assignment to @iwiznia (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

melvin-bot[bot] avatar Sep 29 '22 16:09 melvin-bot[bot]

Triggered auto assignment to @MitchExpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

melvin-bot[bot] avatar Sep 29 '22 19:09 melvin-bot[bot]

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

melvin-bot[bot] avatar Sep 29 '22 19:09 melvin-bot[bot]

Triggered auto assignment to @MonilBhavsar (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Sep 29 '22 19:09 melvin-bot[bot]

Upwork Job

MitchExpensify avatar Sep 29 '22 22:09 MitchExpensify

Proposal

It can be solved by the following:

  1. Using autoFocus prop. Reference
  2. Use ref prop by setting it in componentDidMount or in useeffect

16NTU116 avatar Sep 29 '22 22:09 16NTU116

@MonilBhavsar, @MitchExpensify, @Santhosh-Sellavel Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Oct 03 '22 06:10 melvin-bot[bot]

@Santhosh-Sellavel could you please take a look at the proposals when you get chance

MonilBhavsar avatar Oct 03 '22 09:10 MonilBhavsar

@Puneet-here Can you add the behavior(recordings) of all platforms here after applying your proposal, thanks!

Santhosh-Sellavel avatar Oct 03 '22 17:10 Santhosh-Sellavel

Also @MonilBhavsar Please confirm if the autofocus is expected here with the design/product team. Autofocus creates weird keyboard issues in native I believe intentionally we don't set autofocus, thanks!

Santhosh-Sellavel avatar Oct 03 '22 19:10 Santhosh-Sellavel

@MitchExpensify or @MonilBhavsar Due to Limited Availability unassigning this one. Can you reapply the external label to get another C+ assigned thanks!

Santhosh-Sellavel avatar Oct 03 '22 19:10 Santhosh-Sellavel

Current assignee @MitchExpensify is eligible for the External assigner, not assigning anyone new.

melvin-bot[bot] avatar Oct 04 '22 03:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 04 '22 03:10 melvin-bot[bot]

Current assignee @MonilBhavsar is eligible for the External assigner, not assigning anyone new.

melvin-bot[bot] avatar Oct 04 '22 03:10 melvin-bot[bot]

@Puneet-here what does it look like on iOS Safari, and macOS Safari?

rushatgabhane avatar Oct 04 '22 11:10 rushatgabhane

Please confirm if the autofocus is expected here with the design/product team. Autofocus creates weird keyboard issues in native I believe intentionally we don't set autofocus, thanks!

We discussed internally and in this particular case we want to set the autoFocus, so we're open to proposals!

MonilBhavsar avatar Oct 04 '22 13:10 MonilBhavsar

Safari macOS:

https://user-images.githubusercontent.com/101883770/193843212-4d171439-493c-44d9-b1ef-0f85db8fb700.mov

Safari Ios:

https://user-images.githubusercontent.com/101883770/193843223-c8f41a38-7535-4513-9a63-41c494c23630.mov

We can also use shouldDelayFocus to be on the safer side.

Puneet-here avatar Oct 04 '22 14:10 Puneet-here

Sorry, forgot to mention. In this particular case, we also want keyboard to open on Mobile devices when the field is auto focussed.

MonilBhavsar avatar Oct 04 '22 14:10 MonilBhavsar

Sorry, forgot to mention. In this particular case, we also want keyboard to open on Mobile devices when the field is auto focussed

cc @Puneet-here

rushatgabhane avatar Oct 06 '22 13:10 rushatgabhane

Yeah the keyboard opens, it was on simulator and I hadn't turned on the soft keyboard. I have checked it and it's working.

Puneet-here avatar Oct 07 '22 20:10 Puneet-here

cool, updating later today

rushatgabhane avatar Oct 09 '22 22:10 rushatgabhane

@Puneet-here the keyboard doesn't open on Android if we pass autoFocus to TextInput for this page.

rushatgabhane avatar Oct 11 '22 15:10 rushatgabhane

Proposal

The issue on android is due to transitions so we should wait for transitions to complete before focusing the input so we need to pass autoFocus and shouldDelayFocus props to TextInput and it fixes keyboard opening issue on android and ios.

Screen Shot 2022-10-12 at 11 25 26 AM

After Fixing:-

https://user-images.githubusercontent.com/81307212/195267473-2a4d8430-66eb-4782-9d08-fb0fc8033fa6.mov

syedsaroshfarrukhdot avatar Oct 12 '22 06:10 syedsaroshfarrukhdot

@Puneet-here the keyboard doesn't open on Android if we pass autoFocus to TextInput for this page.

For that we can use shouldDelayFocus. I had suggested it at the end here

Puneet-here avatar Oct 12 '22 08:10 Puneet-here

@Puneet-here @syedsaroshfarrukhdot not a fan of delaying focus on all platforms when only android is having the problem.

rushatgabhane avatar Oct 12 '22 14:10 rushatgabhane

@rushatgabhane We can handle shouldDelayFocus on only on android Platform by introducing Platform.OS === 'android' just like below then it will delay focus only on android platform and fixing problem on android.

Screen Shot 2022-10-12 at 7 24 33 PM

syedsaroshfarrukhdot avatar Oct 12 '22 14:10 syedsaroshfarrukhdot

@syedsaroshfarrukhdot inline platform specific code isn't allowed by our style guide. We should use https://github.com/Expensify/App#platform-specific-file-extensions

thought: If we have 10 pages using shouldDelayFocus, will we break all 10 pages into platform specific files for just one prop?

Can we think of a cleaner way to achieve this?

Even better solution would be to remove the need of delaying focus on Android.

rushatgabhane avatar Oct 12 '22 14:10 rushatgabhane