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

[HOLD for payment 2023-07-14] [$1000] Compose box loses focus on coming back from 'Hmm... its not here' page #21678

Closed
6 tasks
kbecciv opened this issue Jun 27, 2023 · 30 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@kbecciv
Copy link

kbecciv commented Jun 27, 2023

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


Action Performed:

  1. Open the app
  2. Open any report
  3. Copy report URL and paste in compose box
  4. Add few numbers to it to make it invalid and send
  5. Click on the link, it should open 'Hmm...it's not here' page
  6. Click on back to observe that app does not focus back on compose box

Expected Result:

App should focus back on compose box on revisit of report

Actual Result:

App does not focus on compose box on coming back from 'Hmm... it's not here' page

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.31-2
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

app.does.not.refocus.after.error.page.1.mp4
Desktop.2023.06.26.-.17.38.43.06.mp4

Expensify/Expensify Issue URL:
Issue reported by: GH handle - @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1687509816386599

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014471479f4d4b1b97
  • Upwork Job ID: 1673840903296954368
  • Last Price Increase: 2023-06-27
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 27, 2023

Triggered auto assignment to @jliexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jun 27, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@ginsuma
Copy link
Contributor

ginsuma commented Jun 27, 2023

Proposal

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

Compose box loses focus on coming back from 'Hmm... its not here' page.

What is the root cause of that problem?

When going back, the previous report does not remount so the composer still loses focus after clicking to the link.

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

We need to trigger focus manually like we did after closing modal to focus the composer .

if (this.willBlurTextInputOnTapOutside && this.props.isFocused && prevProps.modal.isVisible && !this.props.modal.isVisible) {
this.focus();
}

We can use ReportActionComposeFocusManager.composerRef as a signal when going back from "Hmm... its not here" pages because they do not use it.

<FullPageNotFoundView
shouldShow={(!this.props.report.reportID && !this.props.report.isLoadingReportActions && !isLoading) || shouldHideReport}
subtitleKey="notFound.noAccess"
shouldShowCloseButton={false}
shouldShowBackButton={this.props.isSmallScreenWidth}
onBackButtonPress={Navigation.goBack}

Update onBackButtonPress to:

onBackButtonPress={() => {
    ReportActionComposeFocusManager.composerRef.current = null;
    Navigation.goBack();
}}

Adding condition to focus in componentDidUpdate of ReportActionCompose:

if (this.willBlurTextInputOnTapOutside && this.props.isFocused && ReportActionComposeFocusManager.composerRef.current === null) {
    ReportActionComposeFocusManager.composerRef.current = this.textInput;
    this.focus();
}

What alternative solutions did you explore? (Optional)

In ReportActionCompose, we can add listener for focusing after navigating back.

componentDidMount() {
  ...
  this.unsubscribeNavFocus = this.props.navigation.addListener('focus', () => {
      if (this.willBlurTextInputOnTapOutside && !this.props.isFocused && !this.props.modal.isVisible) {
          this.focus();
      }
  });
}
Result
Screen.Recording.2023-06-28.at.5.06.57.AM.mov

@melvin-bot
Copy link

melvin-bot bot commented Jun 27, 2023

Looks like something related to react-navigation may have been mentioned in this issue discussion.

As a reminder, please make sure that all proposals are not workarounds and that any and all attempt to fix the issue holistically have been made before proceeding with a solution. Proposals to change our DeprecatedCustomActions.js files should not be accepted.

Feel free to drop a note in #expensify-open-source with any questions.

@jliexpensify
Copy link
Contributor

Yep, I can replicate on v.32-5. It'd be good to focus back on the Compose box!

@jliexpensify jliexpensify added the External Added to denote the issue can be worked on by a contributor label Jun 27, 2023
@melvin-bot melvin-bot bot changed the title Compose box loses focus on coming back from 'Hmm... its not here' page [$1000] Compose box loses focus on coming back from 'Hmm... its not here' page Jun 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 27, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 27, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 27, 2023

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

@narefyev91
Copy link
Contributor

@ginsuma can we have the same logic which we have for modals checks like prevProps.modal.isVisible && !this.props.modal.isVisible but apply this for FullPageNotFoundView?
You have a prop shouldShow - which indicates when we should show/not show that page:
shouldShow={(!this.props.report.reportID && !this.props.report.isLoadingReportActions && !isLoading) || shouldHideReport}
Maybe we can also use this prop and makes checks inside componentDidUpdate based on prevProps.notFoundPage.isVisible && !this.props.notFoundPage.isVisible.
Let me know wdyt

@ginsuma
Copy link
Contributor

ginsuma commented Jun 29, 2023

@narefyev91 we need something can be shared between two report pages, shouldShow can't.

@ginsuma
Copy link
Contributor

ginsuma commented Jun 29, 2023

Proposal

Update
@narefyev91 I added an alternative solution using navigation listener.

@narefyev91
Copy link
Contributor

narefyev91 commented Jun 30, 2023

@ginsuma Nice! I like alternative solution! #21678 (comment)
🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Jun 30, 2023

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 30, 2023

📣 @ginsuma You have been assigned to this job!
Please apply to this job in Upwork here and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

@jliexpensify
Copy link
Contributor

Invited @dhanashree-sawant for reporting bonus.

@ginsuma and @narefyev91 - what are your Upworks profiles? It would also help if you both put your actual names (in Upworks) in GH, so we can easily find you in the future. Thanks!

@dhanashree-sawant
Copy link

Hi @jliexpensify, Invite accepted. Thank you!

@narefyev91
Copy link
Contributor

Invited @dhanashree-sawant for reporting bonus.

@ginsuma and @narefyev91 - what are your Upworks profiles? It would also help if you both put your actual names (in Upworks) in GH, so we can easily find you in the future. Thanks!

Hey @jliexpensify ! I'm from Callstack - no needs to make any payments in Upwork 👍

@ginsuma
Copy link
Contributor

ginsuma commented Jul 1, 2023

#21962 PR is up @narefyev91 .

@jliexpensify
Copy link
Contributor

@ginsuma what's your Upworks profile?

@jliexpensify
Copy link
Contributor

@ginsuma I have hired you, but please:

  1. Take your profile off Private
  2. Add your Upworks name to your GH handle (so we can find you in the future)

Thanks!

@melvin-bot
Copy link

melvin-bot bot commented Jul 4, 2023

🎯 ⚡️ Woah @narefyev91 / @ginsuma, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @ginsuma got assigned: 2023-06-30 09:44:53 Z
  • when the PR got merged: 2023-07-04 13:15:24 UTC

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jul 7, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Compose box loses focus on coming back from 'Hmm... its not here' page [HOLD for payment 2023-07-14] [$1000] Compose box loses focus on coming back from 'Hmm... its not here' page Jul 7, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 7, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 7, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented Jul 7, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.37-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-07-14. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Jul 7, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@narefyev91] The PR that introduced the bug has been identified. Link to the PR:
  • [@narefyev91] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@narefyev91] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@narefyev91] Determine if we should create a regression test for this bug.
  • [@narefyev91] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@jliexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Daily KSv2 and removed Weekly KSv2 labels Jul 10, 2023
@jliexpensify
Copy link
Contributor

@narefyev91 - could you complete the checklist please? Thanks!

@narefyev91
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR - it was not a regression - mostly code improvement for peace that was not predicted
  • The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment - no comments
  • A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion - no discussions
  • Determine if we should create a regression test for this bug - no actions needed

@jliexpensify
Copy link
Contributor

Nice ty - going to pay out now + the bonus.

@jliexpensify
Copy link
Contributor

Just waiting on @dhanashree-sawant and @ginsuma to accept, then will pay + close job.

@ginsuma
Copy link
Contributor

ginsuma commented Jul 14, 2023

Accepted. Thanks @jliexpensify

@jliexpensify
Copy link
Contributor

All paid! Job closed! Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

6 participants