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] [$500] [Distance] - Replace popup closes after image on ESC #28088

Closed
2 of 6 tasks
kbecciv opened this issue Sep 24, 2023 · 26 comments
Closed
2 of 6 tasks
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 Sep 24, 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. Open the app
  2. Click on plus and click request money
  3. Click on distance and raise complete the request with any data
  4. Open the request money page by clicking twice on request money message
  5. Click on map
  6. Click on 3 dots
  7. Click ESC and observe that map image closes first and then replace popup

Expected Result:

Replace popup should close first on ESC

Actual Result:

Replace popup closes after map image on ESC

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: 1.3.73.0
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

replace.popup.closed.afterwards.ESC.web.mov
Recording.4735.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1695375739034889

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010ef5e7fa3c9c06ba
  • Upwork Job ID: 1705971108000849920
  • Last Price Increase: 2023-09-24
  • Automatic offers:
    • ZhenjaHorbach | Contributor | 26935834
    • dhanashree-sawant | Reporter | 26935835
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 24, 2023
@melvin-bot melvin-bot bot changed the title [Distance] - Replace popup closes after image on ESC [$500] [Distance] - Replace popup closes after image on ESC Sep 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 24, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 24, 2023

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

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

melvin-bot bot commented Sep 24, 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

@melvin-bot
Copy link

melvin-bot bot commented Sep 24, 2023

Triggered auto assignment to @isabelastisser (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Sep 24, 2023

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

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Sep 24, 2023

#28090 (comment)

Fix bug for another bug will fix this too

Or

Proposal

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

Replace popup close after image

What is the root cause of that problem?

The popup exists until the modal closes completely

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

We can update shouldShowThreeDotsButton like

                `shouldShowThreeDotsButton={isAttachmentReceipt && isModalOpen}`

shouldShowThreeDotsButton={isAttachmentReceipt}

Screen.Recording.2023-09-25.at.08.17.26.mov

What alternative solutions did you explore? (Optional)

NA

@straferxdranzex
Copy link

Prioritize Event Listeners:
We need to ensure that the "replace" popup's ESC key action is prioritized over the map's. This might involve adjusting the order in which event listeners are registered or checking the active state of these components.

Hierarchical Check:
When the ESC key is pressed, the app should first check if the "replace" popup is open. If it is, then it should close that first. If the "replace" popup is not open (or has just been closed with the current ESC press), then the app should proceed to check if the map is open and close it if necessary.

Prevent Event Propagation:
When the ESC key action is triggered for the "replace" popup, we should prevent the event from continuing to propagate. This way, once the "replace" popup has closed, the same ESC key action won't immediately close the map image as well.

@melvin-bot
Copy link

melvin-bot bot commented Sep 24, 2023

📣 @StraferDranzex! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@straferxdranzex
Copy link

Contributor details
Your Expensify account email: umerayan6@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01c127aa85a6bb50b9

@melvin-bot
Copy link

melvin-bot bot commented Sep 24, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@DylanDylann
Copy link
Contributor

Proposal

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

  • Replace popup closes after image on ESC

What is the root cause of that problem?

  • Generally, our modal will be hidden after pressing on the "ESC" key.
  • In this case, the ThreeDotMenu modal is displayed inside the AttachmentModal. When pressing on "ESC", AttachmentModal is removed first, that leads to the bug

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

  • We need to make sure that before removing the AttachmentModal, the ThreeDotMenu is hidden by:
  1. Create the ref to the ThreeDotMenu, and then expose the hidePopoperMenu in here
    const hidePopoverMenu = () => {
    InteractionManager.runAfterInteractions(() => {
    onModalHide();
    });
    setPopupMenuVisible(false);
    };
    useImperativeHandle(forwardedRef, () => ({
        hidePopoverMenu,
    }));
  1. Create threeDotMenuRef variable to keep track the above ref:
const threeDotsMenuRef = React.createRef();
  1. Whenever we close the AttachmentModal, we need to check if the ThreeDotMenu modal is openning or not, if yes, run threeDotsMenuRef.current.hidePopoverMenu() before hiding the AttachmentModal by:
    Update this one
    const closeModal = useCallback(() => {
    setIsModalOpen(false);
    }, []);
    to
    const closeModal = useCallback(() => {
        ReportActionComposeFocusManager.threeDotsMenuRef.current.hidePopoverMenu();
        setIsModalOpen(false);
    }, []);

What alternative solutions did you explore? (Optional)

Result

Screencast.from.25-09-2023.13.04.50.webm

@straferxdranzex
Copy link

Re-stated Problem:
The issue we're trying to address is that when the ESC key is pressed, the AttachmentModal closes before the ThreeDotMenu modal, causing the user to see the "Replace" popup close after the image. The expected behavior is for the "Replace" popup to close first.

Root Cause:
The root cause of the problem is how modals are being handled currently. When the ESC key is pressed, the AttachmentModal, which encapsulates the ThreeDotMenu modal, is being dismissed first. This leads to an inconsistent user experience where the internal "Replace" popup (ThreeDotMenu) remains visible momentarily before the external modal (AttachmentModal) disappears.

Suggested Changes:
Your solution of utilizing React's useImperativeHandle hook and refs to manage the hiding order of the modals is clear and precise. By setting a reference to the ThreeDotMenu and exposing the hidePopoverMenu function, we can then programmatically hide the "Replace" popup before dismissing the AttachmentModal. This ensures that the internal modal is always dismissed first, leading to a more consistent user experience.

Alternative Solutions Explored:

Event Propagation Approach: One initial solution I considered was to manage the ESC key event propagation. By ensuring the "Replace" popup's ESC key action takes precedence over the map's, we could prioritize the order of event listeners. If the "Replace" popup was active, the event would stop at that level and not propagate further to the map's ESC event.

Modal Stacking Order: Another method could involve manipulating the stacking order (z-index) of the modals. If the "Replace" popup had a higher stacking order, pressing the ESC key would close it first. However, this method would be less reliable as z-index wouldn't always determine the order of event firing.

Parent-Child Event Management: We could also consider leveraging parent-child component relationships. Instead of checking two separate modals, the parent modal (AttachmentModal) could have a handler that checks the state of its child (ThreeDotMenu). If the child modal is active, the parent modal could trigger its closure before closing itself.

@isabelastisser isabelastisser removed their assignment Sep 25, 2023
@laurenreidexpensify
Copy link
Contributor

@robertKozik how we feeling about the proposals above?

@laurenreidexpensify
Copy link
Contributor

bump @robertKozik

@robertKozik
Copy link
Contributor

Hi all @StraferDranzex @DylanDylann @ZhenjaHorbach ! Thank you all for your proposals 🙇🏼
I'll suggest to choose proposal written by @ZhenjaHorbach as it consist of the clean way of fixing it. Stop rendering the ThreeDotsMenu effectively removes it along with the popup menu. I'm appreciate it more than @DylanDylann proposal as we should use useImperativeHandle when we have no other way of expressing the change by props (as it goes against declarative nature of React, you can read more here in the PitFall section).

Selected Proposal: #28088 (comment)

🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Sep 28, 2023

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

@dangrous
Copy link
Contributor

Yep, this is simple enough and makes sense! Assigning now.

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

melvin-bot bot commented Sep 29, 2023

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

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Sep 29, 2023

📣 @dhanashree-sawant 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@ZhenjaHorbach
Copy link
Contributor

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

Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻 Keep in mind: Code of Conduct | Contributing 📖

PR will be ready today

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 29, 2023
@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 @ZhenjaHorbach got assigned: 2023-09-29 04:55:38 Z
  • when the PR got merged: 2023-10-05 15:53:34 UTC
  • days elapsed: 4

On to the next one 🚀

@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 [$500] [Distance] - Replace popup closes after image on ESC [HOLD for payment 2023-10-16] [$500] [Distance] - Replace popup closes after image on ESC 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 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

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:

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

@robertKozik
Copy link
Contributor

  • [@robertKozik] The PR that introduced the bug has been identified. Link to the PR: Can't identify any particular PR which introduce it
  • [@robertKozik] 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
  • [@robertKozik] 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
  • [@robertKozik] Determine if we should create a regression test for this bug. In my opinion there is no need to create new regression test, it's visual bug which not interfere with any of the user flows
  • [@robertKozik] If we decide to create a regression test for the bug, please propose the [regression test] N/A (https://github.com/Expensify/App/blob/main/contributingGuides/REGRESSION_TEST_BEST_PRACTICES.md) steps to ensure the same bug will not reach production again. N/A

tldr; In my opinion there is no need to create new regression test, it's visual bug which not interfere with any of the user flows

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

Payment Summary

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

8 participants