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-12-06] [$500] Delete request popup closes after map image popup on ESC #30045

Closed
2 of 6 tasks
m-natarajan opened this issue Oct 20, 2023 · 44 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 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented Oct 20, 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!


Version Number: 1.3.87-1
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
Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation:

Action Performed:

  1. Open the app
  2. Open any distance request report or raise one and open
  3. Click on image
  4. Click on 3 dots and click on delete request
  5. When delete confirmation popup is open, press ESC
  6. Observe that image below closes first and delete confirmation popup closes after it

Expected Result:

App should either only close delete confirmation popup on ESC or app should close first delete confirmation popup and then close the image on ESC

Actual Result:

App closes the image below first and then closes delete confirmation popup on ESC

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
mac.chrome.delete.popup.closes.after.image.mov
Recording.129.mp4
MacOS: Desktop
mac.desktop.delete.popup.closes.after.image.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~015397445ef3d88685
  • Upwork Job ID: 1715188446668767232
  • Last Price Increase: 2023-11-03
  • Automatic offers:
    • hoangzinh | Reviewer | 27607852
    • dukenv0307 | Contributor | 27607853
    • dhanashree-sawant | Reporter | 27607855
@m-natarajan m-natarajan 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 Oct 20, 2023
@melvin-bot melvin-bot bot changed the title Delete request popup closes after map image popup on ESC [$500] Delete request popup closes after map image popup on ESC Oct 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 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 melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

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

@abzokhattab
Copy link
Contributor

abzokhattab commented Oct 20, 2023

Proposal

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

Confirmation dialog closes after the attachment modal on pressing ESC

What is the root cause of that problem?

we dont close the delete confirm dialog before the attachment modal is closed:

first of all when we click on ESC it triggers the onClose function:

// Note: Escape key on web/desktop will trigger onBackButtonPress callback
// eslint-disable-next-line react/jsx-props-no-multi-spaces
onBackButtonPress={onClose}

the onClose function itself doesnt close the confirmation dialog first before the closing the main modal:

/**
* close the modal
*/
const closeModal = useCallback(() => {
setIsModalOpen(false);
}, []);
/**

thats why the confirmation dialog closes after the main modal

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

modify the onClose function to close the confirmation before closing the main modal:

    const closeModal = useCallback(() => {
        closeConfirmModal();
        setIsModalOpen(false);
        // eslint-disable-next-line react-hooks/exhaustive-deps
    }, []);

Alternative Solution:

instead of changing the closeModal logic, we can use UseEffect that would update the visiblity of the confirm dialog if the modal is not open:

   useEffect(() => {
        if (isModalOpen) {
            return;
        }
        closeConfirmModal();
    }, [isModalOpen, closeConfirmModal]);

@eh2077
Copy link
Contributor

eh2077 commented Oct 20, 2023

Proposal

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

Delete request popup closes after map image popup on ESC

What is the root cause of that problem?

The root cause of this issue is that, when pressing ESC keyboard shortcut, the Modal update order is

  1. The Modal of AttachmentModal triggers the ESC keydown event first to call Modal.onBackButtonPress and then call e.stopImmediatePropagation();
  2. Method Modal.onClose is call, which sets isModalOpen to false
  3. Method Modal.onModalHide is call, which tries to close attachment modal and confirm delete modal but it results in attachment is dismissed before the delete comfirm modal.

So, the two modals are closed by a single ESC keydown.

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

To fix this issue, we can pass onBackButtonPress to Modal

                onBackButtonPress={() => {
                    if (isAttachmentReceipt && isDeleteReceiptConfirmModalVisible) {
                        setIsDeleteReceiptConfirmModalVisible(false);
                    } else if (!isAttachmentReceipt && isAttachmentInvalid) {
                        setIsAttachmentInvalid(false);
                    } else {
                        closeModal();
                    }
                }}

after this line

onClose={closeModal}

And in BaseModal.js, we change

onBackButtonPress={onClose}

to

onBackButtonPress={onBackButtonPress || onClose}

What alternative solutions did you explore? (Optional)

N/A

@dukenv0307
Copy link
Contributor

dukenv0307 commented Oct 20, 2023

Proposal

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

I think the OP expected is not entirely correct. When we're opening the delete modal, the modal in focus here is the "Delete modal", not the "Attachment modal", and we can also see there's no way for the user to click on the X button to close the AttachmentModal since there's an overlay and we don't want the user to interact with the AttachmentModal. So the keyboard shortcut should behave the same, the ESC keypress should close the delete modal only, if the user next wants to close the AttachmentModal, they can press ESC again. This is aligned with how the user naturally navigates the app and the keyboard shortcuts should mirror what the user will actually do.

What is the root cause of that problem?

When we press ESC the onClose of the AttachmentModal here will be triggered, which closes the attachment modal. And later on once the attachment modal is hidden, the content of it will be unmounted, and the delete modal will disappear because it's in the content of the attachment modal.

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

Update this line so that if the attachment modal is overlayed by the confirm modal, it will not listen to ESC keypress and the confirm modal will have the preference for listening to the ESC.

const isOverlayModalVisible = (isAttachmentReceipt && isDeleteReceiptConfirmModalVisible) || (!isAttachmentReceipt && isAttachmentInvalid)
...
onClose={isOverlayModalVisible ? null : closeModal}

We can modify the BaseModal a bit to be safe when calling the closeModal (because closeModal could be falsy now).

What alternative solutions did you explore? (Optional)

We can pass undefined as the closeModal in the above case and make closeModal an optional prop of BaseModal. It's better to make it optional since if we don't allow the modal to be closed (like when it's overlayed), we don't want to register onClose since it might override other modals on top.

@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

📣 @nimishdubey2! 📣
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>

@MitchExpensify
Copy link
Contributor

Cannot reproduce yet

@melvin-bot melvin-bot bot added the Overdue label Oct 23, 2023
@hoangzinh
Copy link
Contributor

@MitchExpensify I still reproduce the issue in the latest main branch

Screen.Recording.2023-10-23.at.23.34.44.mov

@melvin-bot melvin-bot bot removed the Overdue label Oct 23, 2023
@eh2077
Copy link
Contributor

eh2077 commented Oct 25, 2023

@MitchExpensify You can change the playback speed of the above video to find the transitions of first closing the background image and then delete popup dialog, see

Screen.Recording.2023-10-25.at.11.24.01.AM.mov

@melvin-bot melvin-bot bot added the Overdue label Oct 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 27, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 27, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 31, 2023

@hoangzinh, @MitchExpensify Still overdue 6 days?! Let's take care of this!

@hoangzinh
Copy link
Contributor

Reviewing today.

@melvin-bot melvin-bot bot removed the Overdue label Nov 1, 2023
@hoangzinh
Copy link
Contributor

hoangzinh commented Nov 1, 2023

@MitchExpensify I think the Expected result for this GH issue is: if the user presses ESC, it should only close the Delete confirmation modal. And then if the user continues to press ESC, it closes the image popup. Do you agree?

Copy link

melvin-bot bot commented Nov 3, 2023

@hoangzinh @MitchExpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Nov 3, 2023
@hoangzinh
Copy link
Contributor

@MitchExpensify waiting for your thought on it #30045 (comment)

Copy link

melvin-bot bot commented Nov 10, 2023

@hoangzinh @MariaHCD @MitchExpensify @dukenv0307 this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!

Copy link

melvin-bot bot commented Nov 10, 2023

@hoangzinh @MariaHCD @MitchExpensify @dukenv0307 this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!

@MitchExpensify
Copy link
Contributor

@dukenv0307 When do you expect the PR to be ready for review? Thanks!

@dukenv0307
Copy link
Contributor

@MitchExpensify I am working on the PR. Will be ready today

@dukenv0307
Copy link
Contributor

@hoangzinh The PR is ready for review.

@MitchExpensify
Copy link
Contributor

Awesome! Thanks, @dukenv0307 - Please review, @hoangzinh 🙇‍♂️

@hoangzinh
Copy link
Contributor

@MitchExpensify yay, we're working on the PR #31256

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 29, 2023
@melvin-bot melvin-bot bot changed the title [$500] Delete request popup closes after map image popup on ESC [HOLD for payment 2023-12-06] [$500] Delete request popup closes after map image popup on ESC Nov 29, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 29, 2023
Copy link

melvin-bot bot commented Nov 29, 2023

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

Copy link

melvin-bot bot commented Nov 29, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.4-3 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-12-06. 🎊

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:

Copy link

melvin-bot bot commented Nov 29, 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:

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

@MitchExpensify
Copy link
Contributor

Payment summary:

@hoangzinh
Copy link
Contributor

BugZero Checklist:

  • The PR that introduced the bug has been identified. Link to the PR: Allow detaching receipts from transactions #26219
  • 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: https://github.com/Expensify/App/pull/26219/files#r1415853071
  • 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: ⛔ This is just a UI/UX improvement.

@MitchExpensify
Copy link
Contributor

All paid!

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

7 participants