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-10-30] [$500] Copy to clipboard tooltip moves to top left corner on copy to clipboard click #29678

Closed
2 of 6 tasks
kbecciv opened this issue Oct 16, 2023 · 34 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

@kbecciv
Copy link

kbecciv commented Oct 16, 2023

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.3.84.4
Reproducible in staging?: y
Reproducible in production?: n
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
Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1697387056991069

Action Performed:

  1. Open the app
  2. Open any report
  3. Click on self profile pic or any user profile pic
  4. Hover first on email/phone number and then hover and click on 'copy to clipboard'
  5. Do not move the cursor and observe that tooltip shifts to top left corner of screen

Expected Result:

App should display tooltip above copy to clipboard after click on it

Actual Result:

App displays tooltip in top left corner after click on copy to clipboard

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

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
windows.chrome.copy.to.clipboard.tooltip.displays.top.left.corner.mp4
mac.chrome.copy.to.clipboard.move.to.corner.mov
Recording.5008.mp4
MacOS: Desktop
mac.desktop.copy.to.clipboard.move.to.corner.mov

View all open jobs on GitHub

@kbecciv kbecciv added the DeployBlockerCash This issue or pull request should block deployment label Oct 16, 2023
@OSBotify
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

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

@mountiny
Copy link
Contributor

Clearly a big but I dont think we have to block deploy on this

@Julesssss
Copy link
Contributor

Yep, removing the blocker label. and updating the checklist.

@Julesssss Julesssss added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 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

@alitoshmatov
Copy link
Contributor

alitoshmatov commented Oct 16, 2023

Proposal

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

Copy to clipboard tooltip moves to top left corner on copy to clipboard click

What is the root cause of that problem?

Changed button icon when pressed is triggering updateBounds function to recalculate tooltips position.

const updateBounds = (bounds) => {

This function ,in turn, is calling chooseBoundingBox to get bounding box of the button.
return target.getBoundingClientRect();

When mouse is not moved, target element is unmounted from dom, because button icon is changing. Also target only gets updated when mouse is moved. That is why chooseBoundingBox is returning us inaccurate target element. Also fallback bounding box is inaccurate here, since target element is unmounted

// If no matching bounding box is found, fall back to getBoundingClientRect.
return target.getBoundingClientRect();

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

We should utilize bounds argument provided in updateBounds function and set it as fallback in chooseBoundingBox. We can either path bounds to chooseBoundingBox function and replace last return with this:

// If no matching bounding box is found, fall back to getBoundingClientRect.
    return bounds;

Or we can return null from chooseBoundingBox when no valid bounding box is selected, and use available bounds:

const betterBounds = chooseBoundingBox(target.current, initialMousePosition.current.x, initialMousePosition.current.y) || bounds;

What alternative solutions did you explore? (Optional)

@garrettmknight garrettmknight added the External Added to denote the issue can be worked on by a contributor label Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

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

melvin-bot bot commented Oct 16, 2023

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

@garrettmknight
Copy link
Contributor

Reproduced - opening up to external for a fix

@garrettmknight garrettmknight changed the title Copy to clipboard tooltip moves to top left corner on copy to clipboard click [$500] Copy to clipboard tooltip moves to top left corner on copy to clipboard click Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

⚠️ Could not update price automatically because there is no linked Upwork Job ID. The BZ team member will need to update the price manually in Upwork.

@garrettmknight
Copy link
Contributor

Will create Upwork job when we're ready to assign.

@akamefi202
Copy link
Contributor

akamefi202 commented Oct 17, 2023

Proposal

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

Copy to clipboard tooltip moves to top left corner on copy to clipboard click.

What is the root cause of that problem?

const updateTargetAndMousePosition = useCallback((e) => {
target.current = e.target;
initialMousePosition.current = {x: e.clientX, y: e.clientY};
}, []);

Whenever hover event occurs, updateTargetAndMousePosition function is called to get target of the event.

// If no matching bounding box is found, fall back to getBoundingClientRect.
return target.getBoundingClientRect();

And from target, the app gets bounds data to display tooltip.

  1. Do not move the cursor and observe that tooltip shifts to top left corner of screen

But in the step 5 of this issue, target of hover event returns <path> tag because the user is pointing on the svg icon.
And the app gets zero as bounds data because <path> tags are not DOMRect objects.
getBoundingClientRect & getClientRects function return empty or zero data in this case.

As a result, we see the tooltip in the top left corner of the screen.

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

We should get currentTarget of the event inside updateTargetAndMousePosition function.

target.current = e.currentTarget;

So we can get correct target object which has the handler and we can also get correct bounds data for tooltip.

What alternative solutions did you explore? (Optional)

N/A

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

grgia commented Oct 19, 2023

All yours @akamefi202! Thank you for your proposal

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Oct 19, 2023
@akamefi202
Copy link
Contributor

The PR is merged.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 23, 2023
@melvin-bot melvin-bot bot changed the title [$500] Copy to clipboard tooltip moves to top left corner on copy to clipboard click [HOLD for payment 2023-10-30] [$500] Copy to clipboard tooltip moves to top left corner on copy to clipboard click Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.88-11 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-10-30. 🎊

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:

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 Oct 23, 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.
  • [@garrettmknight] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@s77rt
Copy link
Contributor

s77rt commented Oct 23, 2023


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

  1. Verify that the correct tooltip is displayed over each of the action options (copy link, download, copy to clipboard, mark as unread)
  2. Click the copy to clipboard option
  3. Verify the tooltip position stays the same
  4. Move the cursor away from the options

@garrettmknight
Copy link
Contributor

QA added - now we wait for payment.

@garrettmknight
Copy link
Contributor

Offers out for payment in the meantime.

@akamefi202
Copy link
Contributor

akamefi202 commented Oct 24, 2023

@garrettmknight I received the offer in Upwork. I should accept it again?

@s77rt
Copy link
Contributor

s77rt commented Oct 24, 2023

@garrettmknight No payment is due for me here since it's a regression.

@garrettmknight
Copy link
Contributor

My mistake @s77rt thanks for keeping me honest

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 29, 2023
@akamefi202
Copy link
Contributor

@garrettmknight Could you please complete this issue if there isn't other problem?

@garrettmknight
Copy link
Contributor

Summarizing payment:

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

10 participants