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-16] [$1000] Web - Chat - Hover effect lost after opening popover again before closing it. #25582

Closed
1 of 6 tasks
izarutskaya opened this issue Aug 21, 2023 · 73 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 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Aug 21, 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 any chat
  2. Open the pop over right clicking
  3. Move the pointer to the left or the right and right click again.

Expected Result:

The hover effect is present

Actual Result:

The hover effect is lost

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: v1.3.55-7

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

Screen.Recording.2023-08-11.At.12.12.21.Pm.mp4
20230821_200158.mp4

Expensify/Expensify Issue URL:

Issue reported by: @getusha

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1691745427354299

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c432588dbb79d8dd
  • Upwork Job ID: 1693717160574693376
  • Last Price Increase: 2023-09-11
  • Automatic offers:
    • abdulrahuman5196 | Reviewer | 26972863
    • getusha | Contributor | 26972865
    • getusha | Reporter | 26972866
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 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

@getusha
Copy link
Contributor

getusha commented Aug 21, 2023

Proposal

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

Hover effect lost after opening context menu popover again before closing the opened one.

What is the root cause of that problem?

We are passing toggleContextMenuFromActiveReportAction as onHide argument, which will make the isContextMenuActive false, currently we are passing empty function to be triggered for onShow param.

onShow = () => {},
onHide = () => {},

() => {},
toggleContextMenuFromActiveReportAction,

when we set isContextMenuActive to true here, when the previous context menu closes it will replace our true value with false. because onHide is triggered after the new isContextMenuActive update.

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

We should set isContextMenuActive to true onShow instead of calling it here:

setIsContextMenuActive(true);

We should move setIsContextMenuActive to here, to be triggered onShow after onHide is called. this will insure it has the updated value.

() => setIsContextMenuActive(true),

Result:

Screen.Recording.2023-08-21.at.5.57.56.PM.mov

What alternative solutions did you explore? (Optional)

@Pujan92
Copy link
Contributor

Pujan92 commented Aug 21, 2023

onHide is triggered after the new isContextMenuActive update

@getusha I am about to propose the same solution but just wanted to understand the above point.

@getusha
Copy link
Contributor

getusha commented Aug 21, 2023

@Pujan92

setIsContextMenuActive(true);

after the above update onHide will be triggered for the previous context menu then the new popover shows right? Once the onHide function is triggered, it will set the state to false, overriding the updated value which was set before opening the popover.

@tjferriss tjferriss added the External Added to denote the issue can be worked on by a contributor label Aug 21, 2023
@melvin-bot melvin-bot bot changed the title Web - Chat - Hover effect lost after opening popover again before closing it. [$1000] Web - Chat - Hover effect lost after opening popover again before closing it. Aug 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01c432588dbb79d8dd

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

melvin-bot bot commented Aug 21, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

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

@aimane-chnaif
Copy link
Contributor

FYI: there's another solution by @allroundexperts: #24515 (comment)
Let's see if anyone proposes better solution than this one.

@getusha
Copy link
Contributor

getusha commented Aug 21, 2023

@aimane-chnaif i have a proposal here

@tienifr
Copy link
Contributor

tienifr commented Aug 22, 2023

Proposal

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

The hover effect is lost after opening popover again before closing it

What is the root cause of that problem?

In the popover onHide, it will trigger this

setIsContextMenuActive(ReportActionContextMenu.isActiveReportAction(props.action.reportActionID));
, causing the isContextMenuActive to become false, which overrides the true value that we set here, causing the hover to not display.

So the problem here is that we're still setting isContextMenuActive to false even though we're still having context menu on that report action item.

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

We need to make sure we don't set isContextMenuActive to false if we're about to open a context menu on that same report action item.

  1. Create a new willShowContextMenu ref
  2. In here, set the ref to true since we're opening the context menu on that item
  3. In here, early return if the ref is true, since we're opening a context menu on that report action item, we don't want to set isContextMenuActive to false.
  4. In onShow here, set willShowContextMenu back to false since the modal already shows.

This will make sure:

  • We don't incorrectly set the isContextMenuActive to false which cause unnecessary re-rendering of the report action item. The added ref has no overhead since ref doesn't cause re-render.
  • In slow device, we avoid flickering if the "no hover" effect shows for a brief moment while the isContextMenuActive goes from false to true
  • We don't rely on the orders in which onShow and onHide are called, which might not always be the same and can cause race condition

What alternative solutions did you explore? (Optional)

NA

@bernhardoj
Copy link
Contributor

Proposal

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

Hover effect is lost when we right-click the same report action. We can see this issue too on LHN.

What is the root cause of that problem?

I think everyone explains it really well. The hover effect is coming from isContextMenuActive state. When we open a context menu, we will immediately set the state to true and will set it to false when the modal hides.

setIsContextMenuActive(true);
const selection = SelectionScraper.getCurrentSelection();
ReportActionContextMenu.showContextMenu(
ContextMenuActions.CONTEXT_MENU_TYPES.REPORT_ACTION,
event,
selection,
popoverAnchorRef,
props.report.reportID,
props.action,
props.draftMessage,
() => {},
toggleContextMenuFromActiveReportAction,
ReportUtils.isArchivedRoom(originalReport),
ReportUtils.chatIncludesChronos(originalReport),
);

When we right-click it the second time,

  1. isContextMenuActive is immediately set again to true
  2. The first context menu hides, thus setting isContextMenuActive back to false

The reason we want to set isContextMenuActive immediately is that on the small screen, we have the modal animation (we don't have the animation anymore on the web). Setting the isContextMenuActive inside onShow will show the hover effect a bit late.

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

Instead of using onShow, we can use onModalWillShow, but our popover without overlay doesn't support onModalWillShow prop (I think this is one of the downsides of maintaining our own modal), so here is the complete step on what we need to do.

  1. For PopoverWithoutOverlay, call onModalWillShow here
    if (props.isVisible) {
    props.onModalShow();
  2. For BaseModal, pass the this.props.onModalWillShow to the Modal.
  3. Replace onModalShow with onModalWillShow (we will adjust all naming from '...Show' to '...WillShow')
    onModalShow={this.runAndResetOnPopoverShow}
  4. Pass the setIsContextMenuActive to the onWillShow (currently onShow) of showContextMenu params.
    setIsContextMenuActive(true);
    const selection = SelectionScraper.getCurrentSelection();
    ReportActionContextMenu.showContextMenu(
    ContextMenuActions.CONTEXT_MENU_TYPES.REPORT_ACTION,
    event,
    selection,
    popoverAnchorRef,
    props.report.reportID,
    props.action,
    props.draftMessage,
    () => {},
    toggleContextMenuFromActiveReportAction,
    ReportUtils.isArchivedRoom(originalReport),
    ReportUtils.chatIncludesChronos(originalReport),
    );

    (we can actually replace setIsContextMenuActive with toggleContextMenuFromActiveReportAction)

@melvin-bot melvin-bot bot added the Overdue label Aug 24, 2023
@tjferriss
Copy link
Contributor

@abdulrahuman5196 can you please review the proposals?

@melvin-bot
Copy link

melvin-bot bot commented Aug 28, 2023

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

@abdulrahuman5196
Copy link
Contributor

Apologies for the delay. Will check and update soon

@melvin-bot melvin-bot bot removed the Overdue label Aug 28, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 28, 2023

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

@abdulrahuman5196
Copy link
Contributor

abdulrahuman5196 commented Aug 29, 2023

I tested @getusha proposal #25582 (comment) on web and it seems to be working. It seemed the straightforward solution for now.

But @bernhardoj pointed out the reason behind this original decision

The reason we want to set isContextMenuActive immediately is that on the small screen, we have the modal animation (we don't have the animation anymore on the web)

I will check the effect of all the proposals on mobile devices and web as well and update again.

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

getusha commented Oct 2, 2023

@abdulrahuman5196 @pecanoro the PR is ready!

@melvin-bot
Copy link

melvin-bot bot commented Oct 5, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @getusha got assigned: 2023-10-02 04:09:59 Z
  • when the PR got merged: 2023-10-05 06:04:54 UTC
  • days elapsed: 3

On to the next one 🚀

@abdulrahuman5196
Copy link
Contributor

Just to note: This issue would be applicable for speed bonus, since the C+ approval was made before 3 days mark and there where no changes after that.

@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 9, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Web - Chat - Hover effect lost after opening popover again before closing it. [HOLD for payment 2023-10-16] [$1000] Web - Chat - Hover effect lost after opening popover again before closing it. Oct 9, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

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

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 9, 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:

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

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

The PR that introduced the bug has been identified. Link to the PR:
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:
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:

Doesn't seem to be a regression. This issue should be present from before.

Determine if we should create a regression test for this bug.

Yes.

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.

  1. Go to any chat
  2. Open the pop over right clicking
  3. Move the pointer to the left or the right and right click again.
  4. Move the mouse out of the report item
  5. Verify that the hover effect is not lost when the popover is opened

@melvin-bot melvin-bot bot added the Overdue label Oct 19, 2023
@getusha
Copy link
Contributor

getusha commented Oct 19, 2023

@tjferriss I received $50 offer for reporting bonus, i think it should be $250 since this issue was created before the announcement.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

@pecanoro, @tjferriss, @abdulrahuman5196, @getusha Whoops! This issue is 2 days overdue. Let's get this updated quick!

@pecanoro
Copy link
Contributor

@tjferriss Friendly bump since this is waiting on you.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 23, 2023
@tjferriss
Copy link
Contributor

The payments have been sent via Upworks.

@melvin-bot melvin-bot bot removed the Overdue label Oct 25, 2023
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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests