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-12-07] [$2000] magic code input remains highlighted even after not being focused #18244

Closed
2 of 6 tasks
kavimuru opened this issue May 1, 2023 · 200 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

Comments

@kavimuru
Copy link

kavimuru commented May 1, 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 login page
  2. enter email and click on continue button
  3. click on outside of the input field to lose focus

Expected Result:

input should not be highlighted after losing focus

Actual Result :

input remains highlighted even after losing focus

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: dev
Reproducible in staging?: needs reproduction
Reproducible in production?: needs reproduction
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

Screen.Recording.2023-05-01.at.7.25.20.PM.mov

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01790579d65d182333
  • Upwork Job ID: 1653522863070584832
  • Last Price Increase: 2023-05-15
@kavimuru kavimuru added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels May 1, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

MelvinBot commented May 1, 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

@Christinadobrzyn
Copy link
Contributor

Christinadobrzyn commented May 2, 2023

Looks like we have a few focus/cursor issues but I think this one is different.
I assume what we want is either

  • The cursor to remain on the "Phone or email" line even when clicking the other parts of the landing page
  • Prohibit highlighting the landing page as we do with old dot and on the mobile apps with NewExpensify

@Christinadobrzyn Christinadobrzyn added External Added to denote the issue can be worked on by a contributor and removed Needs Reproduction Reproducible steps needed labels May 2, 2023
@melvin-bot melvin-bot bot changed the title DEV: magic code input remains highlighted even after not being focused [$1000] DEV: magic code input remains highlighted even after not being focused May 2, 2023
@MelvinBot
Copy link

Job added to Upwork: https://www.upwork.com/jobs/~01790579d65d182333

@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

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

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

@chafikchaban
Copy link

Proposal

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

magic code input is autofocused

What is the root cause of that problem?

a few things combined:

  • MagicCodeInput's initial state value for focusedIndex is 0 ( index of the first input which gets highlighted ).
  • in BaseValidateCodeForm we not only add autoFocus prop to the MagicCodeInput component but also insist on auto focus by invoking MagicCodeInput's focus() method manually when the component mounts

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

two things:

  • initialise focusedIndex state as undefined ( no input is initially focused )
  • pass autoFocus prop to MagicCodeInput with the value of false
  • remove this.inputValidateCode.focus() call on BaseValidateCodeForm's componentDidMount level

What alternative solutions did you explore? (Optional)

none.

Result

Screen.Recording.2023-05-03.at.1.10.01.AM.mov

@alitoshmatov
Copy link
Contributor

alitoshmatov commented May 3, 2023

Proposal

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

DEV: magic code input remains highlighted even after not being focused

What is the root cause of that problem?

We are just setting focus when pressed or mounted, but we should also remove focus when onblured

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

We should add onBlur method to magic code input. In this method we should check if focus is really being sent outside of input groups like this:
_.includes(this.inputRefs, e.nativeEvent.relatedTarget)
and if it does, set focusedIndex and editIndex to undefined. If we do not check for the focus destination, when entering numbers focus will flicker, and also deleting numbers won't work as expected as well.

What alternative solutions did you explore? (Optional)

@situchan
Copy link
Contributor

situchan commented May 3, 2023

Proposal

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

Magic code input remains highlight even after being blurred

What is the root cause of that problem?

We're setting highlight when pressed but no logic to remove highlight when blurred

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

Add onBlur callback on TextInput in MagicCodeInput.
In this callback, if this.inputRefs doesn't contain e.nativeEvent.relatedTarget, clear focusedIndex, editIndex to undefined. This condition is needed for left, right arrows to work. We should not clear focusedIndex, editIndex values when focus is transferred from one input to another input. They should be cleared only when all 6 inputs are blurred.

Improvement: to make Tab/Shift+Tab key work similar to left/right arrow, use onFocus callback instead of onPress callback and deprecate old onFocus callback.

Note: my proposal cannot be similar to @alitoshmatov's proposal. Here's the first reason: #15486 (comment)

@Santhosh-Sellavel
Copy link
Collaborator

@situchan What's different in your proposals?

As far as I can see the @alitoshmatov proposed the solution first here even including edits.

Screenshot 2023-05-03 at 9 34 24 PM

Screenshot 2023-05-03 at 9 34 43 PM

@situchan
Copy link
Contributor

situchan commented May 3, 2023

yes, I had thought if edited proposal was earlier, it would have been acceptable.
But in #15486, my proposal was not accepted even though my edited proposal was earlier than accepted proposal, only because I didn't post new comment "Proposal updated".

@situchan
Copy link
Contributor

situchan commented May 3, 2023

cc: @marcochavezf @mallenexpensify as you were assigned on related issue

@alitoshmatov
Copy link
Contributor

I just thought it was ok since there were not any proposals after mine at the time when I was updating

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented May 3, 2023

I do not have the full context of #15486. Just my thoughts on this matter.

It's okay to edit the proposal before C+ starts reviewing.
But once the proposal review has started it's important to leave an updated comment message.
If the changes are just improving the existing approach it's okay to edit, But if the approach changes or more changes it's better to leave a new comment mentioningProposal 2or updated proposal at the start of the comment.

@situchan I think this is not the place to continue this discussion here. If still something unresolved please start a discussion in Slack in Expensify-bugs or Expensify-open-source, thanks!

@situchan
Copy link
Contributor

situchan commented May 3, 2023

image

Here's is full context ☝️

I don't mind which proposal is accepted here but just for consistency between issues so no one has doubt.

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented May 3, 2023

As I mentioned early here

@situchan I think this is not the place to continue this discussion here. If still something unresolved please start a discussion in Slack in Expensify-bugs or Expensify-open-source, thanks!

Thanks again!

@aimane-chnaif
Copy link
Contributor

I suggest to hold this for #18398 where MagicCodeInput component is being refactored to functional component.

@dangrous
Copy link
Contributor

dangrous commented May 4, 2023

I don't think it'll hugely matter either way since it'll come up as merge conflicts for whoever tries to push first but yeah let's hold for now so we don't have to make changes twice (not a big issue so the delay will be fine)

@MitchExpensify
Copy link
Contributor

Reminder set to pay on the 9th

@wojtus7
Copy link
Contributor

wojtus7 commented Oct 3, 2023

@mountiny @dangrous @Santhosh-Sellavel I created a new PR that also fixes both reported blockers here: #28711

@Santhosh-Sellavel
Copy link
Collaborator

@MitchExpensify Payments have to wait here, Original PR has been reverted due to breakages there is follow up PR: #28711

@mountiny mountiny changed the title [HOLD for payment 2023-10-09] [$2000] magic code input remains highlighted even after not being focused [$2000] magic code input remains highlighted even after not being focused Oct 4, 2023
@mountiny mountiny removed the Awaiting Payment Auto-added when associated PR is deployed to production label Oct 4, 2023
@dangrous
Copy link
Contributor

How are we looking on the updated PR @wojtus7? Thanks!

@Christinadobrzyn
Copy link
Contributor

hum... been a while since an update. reached out to @wojtus7 in slack asking for an update here -https://expensify.slack.com/archives/C04878MDF34/p1699661684165139

@kosmydel
Copy link
Contributor

hum... been a while since an update. reached out to @wojtus7 in slack asking for an update here -https://expensify.slack.com/archives/C04878MDF34/p1699661684165139

The PR has been updated and is ready for another round of review.

@Santhosh-Sellavel
Copy link
Collaborator

Checking again

Copy link

melvin-bot bot commented Nov 30, 2023

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 30, 2023
@melvin-bot melvin-bot bot changed the title [$2000] magic code input remains highlighted even after not being focused [HOLD for payment 2023-12-07] [$2000] magic code input remains highlighted even after not being focused Nov 30, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 30, 2023
Copy link

melvin-bot bot commented Nov 30, 2023

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

Copy link

melvin-bot bot commented Nov 30, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.5-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-12-07. 🎊

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

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Nov 30, 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:

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

@Christinadobrzyn
Copy link
Contributor

prepping for payment

Payouts due:

Issue Reporter: $250 @gadhiyamanan (in Upwork)
Contributor: @wojtus7 - no payment through Upwork or NewExpensify since they are a contractor
Contributor+: $2000 @Santhosh-Sellavel (in NewExpensify)

Eligible for 50% #urgency bonus? N

Upwork job is here.

Do we need a regression test for this?

@gadhiyamanan
Copy link
Contributor

@Christinadobrzyn offer accepted, thanks!

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Dec 7, 2023
@MitchExpensify MitchExpensify removed their assignment Dec 7, 2023
@Christinadobrzyn
Copy link
Contributor

Awesome! @gadhiyamanan I paid you in Upwork based on the payment structure here - #18244 (comment)

@Santhosh-Sellavel will you let me know if we need a regression test for this?

@Santhosh-Sellavel
Copy link
Collaborator

No special regression case test is needed here, existing cases should be enough. We can skip the checklist as well. Let me know if you differ @dangrous

@Christinadobrzyn
Copy link
Contributor

Awesome! Thanks @Santhosh-Sellavel - closing this job as complete!

@Santhosh-Sellavel
Copy link
Collaborator

Requested on ND

@JmillsExpensify
Copy link

$2,000 payment approved for @Santhosh-Sellavel based on this comment.

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