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-07-25] [$250] mWeb - Chat - The emoji picker is closed and user unable to select emoji #44986

Closed
1 of 6 tasks
lanitochka17 opened this issue Jul 8, 2024 · 24 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

@lanitochka17
Copy link

lanitochka17 commented Jul 8, 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.5-3
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4701464
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Tap on a report
  3. Send a message
  4. Long press the message sent and tap emoji plus icon

Expected Result:

The emoji picker must not be closed and user must be able to select emoji

Actual Result:

The emoji picker is closed and user unable to select emoji

Workaround:

Unnown

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

Add any screenshot/video evidence

Bug6535856_1720444503614.Screenrecorder-2024-07-08-18-40-05-542.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012d2a5157510d29ca
  • Upwork Job ID: 1811800348003336181
  • Last Price Increase: 2024-07-12
  • Automatic offers:
    • ikevin127 | Reviewer | 103132063
Issue OwnerCurrent Issue Owner: @muttmuure
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 8, 2024
Copy link

melvin-bot bot commented Jul 8, 2024

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

@lanitochka17
Copy link
Author

@muttmuure 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

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp

@bernhardoj
Copy link
Contributor

bernhardoj commented Jul 9, 2024

Proposal

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

The emoji picker is closed immediately when opening it from the context menu.

What is the root cause of that problem?

In the modal component, we set a popstate listener which will close the modal when triggered if shouldHandleNavigationBack is true (it's only true for emoji picker).

if (shouldHandleNavigationBack) {
window.history.pushState({shouldGoBack: true}, '', null);
window.addEventListener('popstate', handlePopStateRef.current);
}

It's triggered when we call back here when the modal is closed if the state contains shouldGoBack property that we push above.

const hideModal = () => {
setStatusBarColor(previousStatusBarColor);
onModalHide();
if ((window.history.state as WindowState)?.shouldGoBack) {
window.history.back();
}
};

However, the back is triggered even though we don't close the emoji picker. That's because it's triggered from the context menu hide. When we show the emoji picker, the context menu is closed which triggers the back. shouldGoBack exists in the history state because the emoji picker is shown first which already pushes the new state that sets shouldGoBack to true.

Long-press comment -> context menu shown -> press add emoji reaction -> push state, shouldGoBack: true -> context menu hides -> history.back -> triggers popstate -> emoji picker closes

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

We can wait until the context menu is closed before showing the emoji picker using Modal.close. We can apply it here so it's applied to every component that shows an emoji picker, or we can just apply it in context menu case.

function showEmojiPicker(
onModalHide: OnModalHideValue,
onEmojiSelected: OnEmojiSelected,
emojiPopoverAnchor: EmojiPopoverAnchor,
anchorOrigin?: AnchorOrigin,
onWillShow: OnWillShowPicker = () => {},
id?: string,
activeEmoji?: string,
) {
if (!emojiPickerRef.current) {
return;
}
emojiPickerRef.current.showEmojiPicker(onModalHide, onEmojiSelected, emojiPopoverAnchor, anchorOrigin, onWillShow, id, activeEmoji);
}

Modal.close(() => emojiPickerRef.current.showEmojiPicker(onModalHide, onEmojiSelected, emojiPopoverAnchor, anchorOrigin, onWillShow, id, activeEmoji));

What alternative solutions did you explore? (Optional)

Only call back if shouldHandleNavigationBack is true, but I think it won't work if in the future multiple modal enable shouldHandleNavigationBack.

if ((window.history.state as WindowState)?.shouldGoBack) {
window.history.back();
}

@melvin-bot melvin-bot bot added the Overdue label Jul 10, 2024
Copy link

melvin-bot bot commented Jul 11, 2024

@muttmuure Whoops! This issue is 2 days overdue. Let's get this updated quick!

@muttmuure muttmuure added the External Added to denote the issue can be worked on by a contributor label Jul 12, 2024
@melvin-bot melvin-bot bot changed the title mWeb - Chat - The emoji picker is closed and user unable to select emoji [$250] mWeb - Chat - The emoji picker is closed and user unable to select emoji Jul 12, 2024
Copy link

melvin-bot bot commented Jul 12, 2024

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

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

melvin-bot bot commented Jul 12, 2024

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

@ikevin127
Copy link
Contributor

@bernhardoj Thanks for your proposal.

We can wait until the context menu is closed before showing the emoji picker using Modal.close. We can apply it here so it's applied to every component that shows an emoji picker, or we can just apply it in context menu case.

Before I can decide on the RCA / solution, can you please expand on the main solution mentioned above with code example ?
I need enough specifics to be able to apply the solution myself locally and test the fix.

@bernhardoj
Copy link
Contributor

@ikevin127 added the code example

@ikevin127
Copy link
Contributor

Thank you for the update!

@bernhardoj's updated proposal looks good to me. I verified the RCA as correct and the proposed main solution fixes the issue as per the expected result (the emoji modal will open when the button is tapped).

Video
Android: mWeb
android-mweb.mp4

I think it's safe to go with the version which adds Modal.close() within the showEmojiPicker function, such that this issue is covered in all places where showEmojiPicker is currently used.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Jul 13, 2024

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

@melvin-bot melvin-bot bot added Overdue and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels Jul 15, 2024
Copy link

melvin-bot bot commented Jul 15, 2024

📣 @ikevin127 🎉 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

@aldo-expensify
Copy link
Contributor

No overdue, issue assigned

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 Overdue labels Jul 16, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @ikevin127

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jul 18, 2024
@melvin-bot melvin-bot bot changed the title [$250] mWeb - Chat - The emoji picker is closed and user unable to select emoji [HOLD for payment 2024-07-25] [$250] mWeb - Chat - The emoji picker is closed and user unable to select emoji Jul 18, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 18, 2024
Copy link

melvin-bot bot commented Jul 18, 2024

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

Copy link

melvin-bot bot commented Jul 18, 2024

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

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

Copy link

melvin-bot bot commented Jul 18, 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:

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

@ikevin127
Copy link
Contributor

Regression Test Proposal

  1. Send a message to any chat.
  2. Long-press on the message.
  3. Press the add reaction button.
  4. Verify that the emoji picker opens and remains open.

Do we agree 👍 or 👎.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 24, 2024
@ikevin127
Copy link
Contributor

cc @muttmuure

@bernhardoj
Copy link
Contributor

Requested payment in ND.

@muttmuure
Copy link
Contributor

Handling

@muttmuure
Copy link
Contributor

$250 - @ikevin127 C+
$250 - @bernhardoj C

@muttmuure
Copy link
Contributor

Kevin has been paid in Upwork

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

@melvin-bot melvin-bot bot added the Overdue label Jul 29, 2024
@melvin-bot melvin-bot bot removed the Overdue label Jul 29, 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
No open projects
Development

No branches or pull requests

6 participants