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 2024-06-20] [HOLD for payment 2024-06-18] [$250] Settings - When navigated to wallet page, blue bubble selection option is shown. #41197

Closed
3 of 6 tasks
izarutskaya opened this issue Apr 29, 2024 · 59 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

@izarutskaya
Copy link

izarutskaya commented Apr 29, 2024

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


Version Number: 1.4.67-0
Reproducible in staging?: Y
Reproducible in production?: Y
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Tap settings
  3. Long press and select the email id displayed under avatar
  4. Tap Wallet

Expected Result:

When navigated to wallet page, blue bubble selection option should not be shown.

Actual Result:

When navigated to wallet page, blue bubble selection option is shown.

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6464872_1714375428526.cb.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01626cae18fdbd316c
  • Upwork Job ID: 1785760528249442304
  • Last Price Increase: 2024-05-29
Issue OwnerCurrent Issue Owner: @JmillsExpensify
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 29, 2024
Copy link

melvin-bot bot commented Apr 29, 2024

Triggered auto assignment to @JmillsExpensify (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.

@izarutskaya
Copy link
Author

We think this issue might be related to the #vip-vsb.

@melvin-bot melvin-bot bot added the Overdue label May 1, 2024
@JmillsExpensify
Copy link

Adding this to #vip-split and opening up to the community.

@melvin-bot melvin-bot bot removed the Overdue label May 1, 2024
@JmillsExpensify JmillsExpensify added the External Added to denote the issue can be worked on by a contributor label May 1, 2024
@melvin-bot melvin-bot bot changed the title Settings - When navigated to wallet page, blue bubble selection option is shown. [$250] Settings - When navigated to wallet page, blue bubble selection option is shown. May 1, 2024
Copy link

melvin-bot bot commented May 1, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01626cae18fdbd316c

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

melvin-bot bot commented May 1, 2024

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

@melvin-bot melvin-bot bot added the Overdue label May 6, 2024
Copy link

melvin-bot bot commented May 7, 2024

@JmillsExpensify, @sobitneupane Eep! 4 days overdue now. Issues have feelings too...

Copy link

melvin-bot bot commented May 8, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented May 9, 2024

@JmillsExpensify, @sobitneupane 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@sobitneupane
Copy link
Contributor

Waiting Proposal

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels May 10, 2024
Copy link

melvin-bot bot commented May 13, 2024

@JmillsExpensify @sobitneupane this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

Copy link

melvin-bot bot commented May 13, 2024

@JmillsExpensify, @sobitneupane Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@JmillsExpensify
Copy link

Still waiting for proposals

@melvin-bot melvin-bot bot removed the Overdue label May 15, 2024
Copy link

melvin-bot bot commented May 15, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@dominictb
Copy link
Contributor

dominictb commented May 17, 2024

Proposal

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

When navigated to wallet page, blue bubble selection option is shown.

What is the root cause of that problem?

I believe that when we push new route in the navigation stack, the old page (with all of the components) still exist in the document tree. We can see the in the Chrome DevTools

image

Hence we can still see the selection even if we move to another screen like in the issue description. If the navigation some how remove the HTML tags from the document tree, we won't see the selection state again.

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

OLD SOLUTION WHICH CAUSES REGRESSION

If the navigation state change, we should clear out the selection in the window. This can be done in the NavigationRoot component handleStateChange function

const handleStateChange = (state: NavigationState | undefined) => {
        ..... // other stuff

        // We want to clear the selection in the window
        window.getSelection()?.removeAllRanges();
    };

[NEW SOLUTION]

Draft PR: #43456

If the navigation state change, we should clear out the selection in the window. This can be done in the NavigationRoot component handleStateChange function

const handleStateChange = (state: NavigationState | undefined) => {
        ..... // other stuff

        // We want to clear the selection in the window
        clearRedundantSelectionRange();
    };

The point is clearRedundantSelectionRanges cannot be naive as window.getSelection().removeAllRanges() as it will causing this regression #43375. In order to avoid this we'll need to loop through all range in the selection (in case of Chrome, we only have 1 range):

const selection = window.getSelection();
  
if(!selection || !selection.rangeCount) {
    return;
  }

  let rangesNeedToBeRemove: Range[] = [];
  for(let i = 0 ; i < selection.rangeCount; ++i) {
    const range = selection.getRangeAt(i);
    if(!shouldThisRangeBeRemoved(range)) {
      continue;
    }
    rangesNeedToBeRemove.push(range);
  }

  rangesNeedToBeRemove.forEach((range) => {
    selection.removeRange(range);
  });

Since the original issue is related to a feature in Chrome called tap-to-search, and based on this article https://developer.chrome.com/blog/tap-to-search, we can argue that as long as the selection range doesn't belong to any editable component, it is safe to remove them.

To check that, we'll need find the closest ancestor of the range.commonAncestorContainer which is an element node (since the selection range container can be text node). If we couldn't find it, we can assume that this range is not editable, i.e return true (safe to remove). We can even add an additional check to check if document.designMode === 'on'

In case we could find that node element ancestor, we should check either the node is input or textarea or node.isContentEditable = true. If this is the case, the the range shouldn't be removed, or else we are safe to remove it.

shouldThisRangeBeRemoved(range) {
 const node = range.commonAncestorContainer as HTMLElement
 // w
  let ancestorNodeToCheck = node.nodeType === Node.ELEMENT_NODE ? node : node.parentElement;
  while(ancestorNodeToCheck && ancestorNodeToCheck.nodeType !== Node.ELEMENT_NODE) {
    ancestorNodeToCheck = ancestorNodeToCheck.parentElement;
  }
  
   // couldn't find closest ancestor node that is an element node
    if(!ancestorNodeToCheck) {
      return document.designMode.toLowerCase() !== 'on'
    }
  
    const nodeName = ancestorNodeToCheck.nodeName.toLowerCase();
  
    if(nodeName === 'input' || nodeName === 'textarea' || ancestorNodeToCheck.isContentEditable) {
      return false;
  }
}

Result:

android-8MB.mp4

In case the selection range is from the Composor, it won't be cleared

aw8.mp4

What alternative solutions did you explore? (Optional)

N/A

@melvin-bot melvin-bot bot added the Overdue label May 17, 2024
@sobitneupane
Copy link
Contributor

Thanks for the proposal @dominictb

It looks like you're new to Expensify. Welcome!

New contributors are limited to working on one job at a time, however experienced contributors may work on numerous jobs simultaneously.

As per the contributing guidelines, new contributor can only work on one issue at a time.

Please let me know if you are assigned to a closed issue or an open issue with the Awaiting payment label.

@melvin-bot melvin-bot bot removed the Overdue label May 19, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jun 13, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-06-18] [$250] Settings - When navigated to wallet page, blue bubble selection option is shown. [HOLD for payment 2024-06-20] [HOLD for payment 2024-06-18] [$250] Settings - When navigated to wallet page, blue bubble selection option is shown. Jun 13, 2024
Copy link

melvin-bot bot commented Jun 13, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.82-4 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 2024-06-20. 🎊

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

  • @sobitneupane requires payment through NewDot Manual Requests
  • @dominictb requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Jun 13, 2024

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:

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

@dominictb
Copy link
Contributor

the risks outweigh the rewards given the benefit of hindsight

It would be great if you guys can explain this.

I believe that the risks have already been outweighs the rewards from the beginning, it's just that my initial solution is so naive/simple that I(or we) overlook the risks. But in the second solution, I had fine-tuned the mechanism in the first solution, but not merely based on the regression bug we had, but with careful consideration of other factors to cover all of the scenarios (as I have explained above). What I'm trying to say is that the second solution is not a reaction to the recent regression, but a well-calibrated one which I (somehow) overlooked when proposing the initial solution, so it shouldn't counted as an temporary workaround for the regression, but a (probably) complete solution to this issue without causing any further regression. With that in mind, I believe that it's worth pursuing the second solution as the calculated risks have been lowered.

I'm happy with any final decision, but it would be nice to understand thoroughly why we shouldn't go forward with the new solution I proposed.

@amyevans
Copy link
Contributor

I'm unassigning since I'm headed out on extended leave after today. If you need input from another internal engineer feel free to do the 🎀 trick! 👋

@amyevans amyevans removed their assignment Jun 14, 2024
@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 18, 2024
Copy link

melvin-bot bot commented Jun 20, 2024

Payment Summary

Upwork Job

BugZero Checklist (@JmillsExpensify)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1785760528249442304/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@melvin-bot melvin-bot bot added the Overdue label Jun 20, 2024
@JmillsExpensify
Copy link

I agree with Amy. I've updated the payment summary above to reflect a payout of $125.

@melvin-bot melvin-bot bot removed the Overdue label Jun 22, 2024
@JmillsExpensify
Copy link

@dominictb mind sharing your Upwork profile so that I can invite you to the Upwork job? The previous one expired.

@dominictb
Copy link
Contributor

@JmillsExpensify Sure, here's my profile link on Upwork: https://www.upwork.com/freelancers/~01f70bed1934fd35d5

@melvin-bot melvin-bot bot added the Overdue label Jun 24, 2024
@JmillsExpensify
Copy link

Offer sent

@melvin-bot melvin-bot bot removed the Overdue label Jun 25, 2024
@JmillsExpensify
Copy link

All paid out! @sobitneupane please complete the checklist and request payments in NewDot.

@JmillsExpensify
Copy link

Whoops @dominictb I'm still waiting for you to accept the offer in Upwork.

@dominictb
Copy link
Contributor

@JmillsExpensify I accepted it, TY

@JmillsExpensify
Copy link

All paid out!

@trjExpensify
Copy link
Contributor

Confirming payment summary as follows:

@JmillsExpensify
Copy link

$125 approved for @sobitneupane

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