Skip to content

[HOLD for payment 2023-12-06] [$500] Delete request popup closes after map image popup on ESC #30045

Closed

Description

@m-natarajan

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

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 20, 2023
  2. changed the title [-]Delete request popup closes after map image popup on ESC[/-] [+][$500] Delete request popup closes after map image popup on ESC[/+] on Oct 20, 2023
  3. melvin-bot commented on Oct 20, 2023

    @melvin-bot

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

  4. melvin-bot commented on Oct 20, 2023

    @melvin-bot
  5. melvin-bot commented on Oct 20, 2023

    @melvin-bot

    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
  6. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 20, 2023
  7. melvin-bot commented on Oct 20, 2023

    @melvin-bot

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

  8. abzokhattab commented on Oct 20, 2023

    @abzokhattab
    Contributor

    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]);
  9. eh2077 commented on Oct 20, 2023

    @eh2077
    Contributor

    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

  10. dukenv0307 commented on Oct 20, 2023

    @dukenv0307
    Contributor

    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.

  11. melvin-bot commented on Oct 20, 2023

    @melvin-bot

    📣 @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>
    
  12. 46 remaining items

  13. 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[/+] on Nov 29, 2023
  14. melvin-bot commented on Nov 29, 2023

    @melvin-bot

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

  15. melvin-bot commented on Nov 29, 2023

    @melvin-bot

    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:

  16. melvin-bot commented on Nov 29, 2023

    @melvin-bot

    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:
  17. MitchExpensify commented on Dec 4, 2023

    @MitchExpensify
    Contributor

    Payment summary:

  18. hoangzinh commented on Dec 5, 2023

    @hoangzinh
    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.
  19. MitchExpensify commented on Dec 7, 2023

    @MitchExpensify
    Contributor

    All paid!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions