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-10-29] [$250] Chat - When emoji picker is opened, right-clicking on message opens and closes context menu #50314

Open
2 of 6 tasks
IuliiaHerets opened this issue Oct 6, 2024 · 22 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

@IuliiaHerets
Copy link

IuliiaHerets commented Oct 6, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.45-2
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): applausetester+pso@applause.expensifail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to any report.
  3. Send a message.
  4. Open emoji picker.
  5. Right click on the message.

Expected Result:

Context menu will open.

Actual Result:

Context menu opens then closes.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6626316_1728236236742.20241007_013425.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021843403179458469285
  • Upwork Job ID: 1843403179458469285
  • Last Price Increase: 2024-10-14
  • Automatic offers:
    • dukenv0307 | Reviewer | 104451584
Issue OwnerCurrent Issue Owner: @RachCHopkins
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 6, 2024
Copy link

melvin-bot bot commented Oct 6, 2024

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

@IuliiaHerets
Copy link
Author

@RachCHopkins FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@ChavdaSachin
Copy link
Contributor

Proposal

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

When emoji picker is opened, right-clicking on message opens and closes context menu.

What is the root cause of that problem?

We display EmojiPicker without overlay.

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

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@bernhardoj
Copy link
Contributor

Proposal

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

Right clicking the message when an emoji picker is opened will close the context menu again.

What is the root cause of that problem?

When we right click on a message while the emoji picker is open, it will close the emoji picker before open the context menu.

onOpen?.({
ref: withoutOverlayRef,
close: onClose,
anchorRef,
});

const onOpen = useCallback(
(popoverParams: AnchorRef) => {
if (activePopoverRef.current && activePopoverRef.current.ref !== popoverParams?.ref) {
closePopover(activePopoverRef.current.anchorRef);
}

When the emoji picker hide, it will call the popover context close function, passing the emoji picker anchor ref.

} else {
onModalHide();
close(anchorRef);
Modal.onModalDidClose();
}

At this point, the anchor ref is null. It's important to pass the anchor ref to ignore the close call if the active popover anchor ref (context menu anchor ref) is different from the passed anchor ref (emoji picker anchor ref).

const closePopover = useCallback((anchorRef?: RefObject<View | HTMLElement | Text>): boolean => {
if (!activePopoverRef.current || (anchorRef && anchorRef !== activePopoverRef.current.anchorRef)) {
return false;
}
activePopoverRef.current.close();

But because the emoji picker anchor ref is null, the logic is passed and activePopoverRef.current.close() is executed which closes the context menu.

The anchor ref is null because we set it to null when closing the emoji picker.

emojiPopoverAnchorRef.current = null;
};
setIsEmojiPickerVisible(false);

However, the real issue here is that, the anchor ref shouldn't be null at all. It should be a ref object, {current: object | null}. This happens after #37641, a TS migration, specifically updating the getEmojiPopoverAnchor code.

* Get the popover anchor ref
*
* emojiPopoverAnchorRef contains either null or the ref object of the anchor element.
* { current: { current: anchorElement } }
*
* Don't directly get the ref from emojiPopoverAnchorRef, instead use getEmojiPopoverAnchor()
*/
const getEmojiPopoverAnchor = useCallback(() => emojiPopoverAnchorRef.current ?? emojiPopoverAnchorRef?.current, []);

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

We need to revert the getEmojiPopoverAnchor changes to

const getEmojiPopoverAnchor = useCallback(() => emojiPopoverAnchorRef.current ?? emojiPopoverAnchorRef as EmojiPopoverAnchor, []);

@RachCHopkins
Copy link
Contributor

Yes, can replicate this.

@RachCHopkins RachCHopkins added the External Added to denote the issue can be worked on by a contributor label Oct 7, 2024
@melvin-bot melvin-bot bot changed the title Chat - When emoji picker is opened, right-clicking on message opens and closes context menu [$250] Chat - When emoji picker is opened, right-clicking on message opens and closes context menu Oct 7, 2024
Copy link

melvin-bot bot commented Oct 7, 2024

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

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

melvin-bot bot commented Oct 7, 2024

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

@dukenv0307
Copy link
Contributor

@bernhardoj's proposal LGTM and tests well

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Oct 8, 2024

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

Copy link

melvin-bot bot commented Oct 11, 2024

@RachCHopkins, @stitesExpensify, @dukenv0307 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Oct 11, 2024
Copy link

melvin-bot bot commented Oct 14, 2024

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

@dukenv0307
Copy link
Contributor

@stitesExpensify can you take a look at this issue? Thanks

Copy link

melvin-bot bot commented Oct 15, 2024

@RachCHopkins, @stitesExpensify, @dukenv0307 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@dukenv0307
Copy link
Contributor

Waiting for @stitesExpensify's response

@RachCHopkins
Copy link
Contributor

Stites has been on leave for the long weekend in the US. He should be back tomorrow!

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

melvin-bot bot commented Oct 16, 2024

📣 @dukenv0307 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Oct 17, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @dukenv0307

Copy link

melvin-bot bot commented Oct 21, 2024

⚠️ 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 Oct 22, 2024
@melvin-bot melvin-bot bot changed the title [$250] Chat - When emoji picker is opened, right-clicking on message opens and closes context menu [HOLD for payment 2024-10-29] [$250] Chat - When emoji picker is opened, right-clicking on message opens and closes context menu Oct 22, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 22, 2024
Copy link

melvin-bot bot commented Oct 22, 2024

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

Copy link

melvin-bot bot commented Oct 22, 2024

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

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

Copy link

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

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

@dukenv0307
Copy link
Contributor

BugZero Checklist:

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

Regression test:

  1. Open any chat
  2. Open the emoji picker
  3. Right click on any message
  4. Verify the emoji picker is closed
  5. Verify the context menu is opened

Do we 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 28, 2024
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
Development

No branches or pull requests

6 participants