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-06-23] [$1000] Invite message input is not auto focus after going back #20092

Closed
6 tasks done
kavimuru opened this issue Jun 2, 2023 · 40 comments
Closed
6 tasks done
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

Comments

@kavimuru
Copy link

kavimuru commented Jun 2, 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. Go to Setting > Workspace
  2. Select any workspace
  3. Go to mange member
  4. Click on the invite button
  5. Select some users and click next button
  6. Notice that invite message input is autofocus
  7. Click on get assistant button to go to get assistance page
  8. Click on back button

Expected Result:

Invite message input shout auto-focus after going back

Actual Result:

Invite message input is not auto-focus after going back

Workaround:

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

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.22-0
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

Screencast.from.01-06-2023.11_35_36.webm
Recording.851.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dukenv0307
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1685594152627279

View all open jobs on GitHub

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

melvin-bot bot commented Jun 2, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 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

@kevinksullivan
Copy link
Contributor

@hoangzinh
Copy link
Contributor

Proposal

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

Invite message input is not auto focus after going back

What is the root cause of that problem?

Currently we only trigger focus for invite message input when componentDidMount

componentDidMount() {
this.focusTimeout = setTimeout(() => {
this.welcomeMessageInputRef.focus();
// Below condition is needed for web, desktop and mweb only, for native cursor is set at end by default.
if (this.welcomeMessageInputRef.value && this.welcomeMessageInputRef.setSelectionRange) {
const length = this.welcomeMessageInputRef.value.length;
this.welcomeMessageInputRef.setSelectionRange(length, length);
}
}, CONST.ANIMATED_TRANSITION);
}

So when we're in the Invite Message page, we go to Assistance page then go back, the Invite Message is not mounted again so above focus logic won't be triggered

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

I think we can listen on navigationFocus change. If the Invite Message previously is not focus, now it's focus, we should trigger focus logic above.

More implement details:

  • Add HOC withNavigationFocus to component WorkspaceInviteMessagePage
  • In componentDidUpdate of component WorkspaceInviteMessagePage, we need to check if !prevProps.isFocused && this.props.isFocused, then we will call the same code in componentDidMount

@melvin-bot
Copy link

melvin-bot bot commented Jun 3, 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.

@melvin-bot melvin-bot bot added the Overdue label Jun 5, 2023
@tienifr
Copy link
Contributor

tienifr commented Jun 5, 2023

Proposal

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

invite message input is not auto focus after going back

What is the root cause of that problem?

In

componentDidMount() {
this.focusTimeout = setTimeout(() => {
this.welcomeMessageInputRef.focus();
// Below condition is needed for web, desktop and mweb only, for native cursor is set at end by default.
if (this.welcomeMessageInputRef.value && this.welcomeMessageInputRef.setSelectionRange) {
const length = this.welcomeMessageInputRef.value.length;
this.welcomeMessageInputRef.setSelectionRange(length, length);
}
}, CONST.ANIMATED_TRANSITION);
}

we focus the input only when the component is mounted. When we open Get assistance modal, the Add message modal is not unmounted, that why when users go back, the input is not re-focused

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

I think we should fix this problem in BaseTextInput.

  1. Add withNavigationFocus to BaseTextInput
  2. In componentDidUpdate check if !prevProps.isFocused && this.props.isFocused && this.props.autoFocus is true, re-focus the input
  3. Add autofocus to WorkspaceInviteMessagePage and other places if needed

Result

Screen.Recording.2023-06-05.at.17.28.12.mov

@kevinksullivan kevinksullivan added the External Added to denote the issue can be worked on by a contributor label Jun 6, 2023
@melvin-bot melvin-bot bot changed the title Invite message input is not auto focus after going back [$1000] Invite message input is not auto focus after going back Jun 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

Job added to Upwork: https://www.upwork.com/jobs/~010b8ccb7d8f4f0c12

@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

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

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

melvin-bot bot commented Jun 6, 2023

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

@kevinksullivan
Copy link
Contributor

Validated this is a bug in slack, moving forward.

@melvin-bot melvin-bot bot removed the Overdue label Jun 6, 2023
@will0225
Copy link

will0225 commented Jun 6, 2023

I will work on this

@s77rt
Copy link
Contributor

s77rt commented Jun 7, 2023

@hoangzinh Thanks for the proposal. Your RCA is correct and the solution makes sense. Let's do it 🚀

🎀 👀 🎀 C+ reviewed

cc @AndrewGable

@s77rt
Copy link
Contributor

s77rt commented Jun 7, 2023

@tienifr Thanks for the proposal. I think it's the same as @hoangzinh's proposal but shifted to BaseTextInput. For this issue I think it may be better to keep the logic in the same page. I prefer to keep navigation related HOC at the pages level as navigation may not be available in some outside cases.

@raphaelppp
Copy link

raphaelppp commented Jun 7, 2023

Proposal

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

Whenever the user comes back from the assistance, the focus is not restored.

This happens at least in two pages : the WorkspaceSettingsPage and the WorkspaceInviteMessagePage,
and probably on every form with an assistance button

What is the root cause of that problem?

The cause is twofold:

  • Whenever the user clicks down any button, including the assistance button, the focus is lost, even if the button has not been pressed. But this behavior may be intended.
  • Whenever the user comes back from the assistance, the focus is not restored.

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

I would modify Form.js:

  • store the last focused inputID before navigating away (onFocus)
  • flag this inputID as pending a refocus when navigating back (navigationRef.addListener)
  • focus the corresponding input during the rendering

What alternative solutions did you explore?

I did not thoroughly explore it, but it may be desirable to prevent buttons in general from stealing the focus when being touched.

@melvin-bot
Copy link

melvin-bot bot commented Jun 7, 2023

📣 @raphaelppp! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@raphaelppp
Copy link

Contributor details
Your Expensify account email: origanot@hotmail.fr
Upwork Profile Link: https://www.upwork.com/freelancers/~018de0a5142fb6cbd2

@melvin-bot
Copy link

melvin-bot bot commented Jun 7, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@s77rt
Copy link
Contributor

s77rt commented Jun 7, 2023

@raphaelppp Thanks for your interest here but we have a proposal template to follow, please read the contributing guide.

@raphaelppp
Copy link

raphaelppp commented Jun 8, 2023

Proposal

[Updated](link to proposal)
My apologies for overlooking the contributing guide.

@melvin-bot
Copy link

melvin-bot bot commented Jun 12, 2023

📣 @hoangzinh You have been assigned to this job by @AndrewGable!
Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@AndrewGable
Copy link
Contributor

Ah I missed this comment, thank you!

@kevinksullivan
Copy link
Contributor

Offers sent to @s77rt and @hoangzinh . @dukenv0307 , can you apply to the job in upwork for reporting?

https://www.upwork.com/jobs/~010b8ccb7d8f4f0c12

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Jun 13, 2023
@hoangzinh
Copy link
Contributor

@s77rt @AndrewGable PR is ready #20667. Please help me review it. Thanks

@dukenv0307
Copy link
Contributor

@kevinksullivan applied, thank you!

@kevinksullivan
Copy link
Contributor

@dukenv0307 hired 👍

@melvin-bot
Copy link

melvin-bot bot commented Jun 14, 2023

🎯 ⚡️ Woah @s77rt / @hoangzinh, 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 @hoangzinh got assigned: 2023-06-12 18:48:12 Z
  • when the PR got merged: 2023-06-14 16:35:44 UTC

On to the next one 🚀

@kevinksullivan
Copy link
Contributor

watching this for 5 more days before paying out.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jun 16, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Invite message input is not auto focus after going back [HOLD for payment 2023-06-23] [$1000] Invite message input is not auto focus after going back Jun 16, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 16, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 16, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.28-5 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-06-23. 🎊

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 Jun 16, 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:

  • [@s77rt] The PR that introduced the bug has been identified. Link to the PR:
  • [@s77rt] 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:
  • [@s77rt] 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:
  • [@s77rt] Determine if we should create a regression test for this bug.
  • [@s77rt] 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.
  • [@kevinksullivan] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@s77rt
Copy link
Contributor

s77rt commented Jun 19, 2023


Regression Test Proposal
In https://expensify.testrail.io/index.php?/cases/view/1971060

  1. Click on "Next" to proceed to the next page
  2. Verify the message field is auto-focused
  3. Click on the "Get assistant" button
  4. Click on back button
  5. Verify the message field is auto-focused

@kevinksullivan
Copy link
Contributor

Testrail update GH is created, will pay this out in a few days assuming no regressions.

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Jun 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 27, 2023

@AndrewGable, @hoangzinh, @s77rt, @kevinksullivan Huh... This is 4 days overdue. Who can take care of this?

@AndrewGable
Copy link
Contributor

@kevinksullivan is going to payout!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jun 28, 2023
@kevinksullivan
Copy link
Contributor

Ah sorry for the delay. This is all set!

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

No branches or pull requests

9 participants