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-05-25] [$1000] On click of ESC while 'copy URL to clipboard' popup is open, app closes both 'copy URL to clipboard' popup and RHN #18558

Closed
1 of 6 tasks
kavimuru opened this issue May 7, 2023 · 39 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

@kavimuru
Copy link

kavimuru commented May 7, 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. Open settings
  3. Right click on Help to open 'copy URL to clipboard'
  4. Click on ESC

Expected Result:

App should only close 'copy URL to clipboard' popup on ESC click like it does for delete workspace popup

Actual Result:

App closes both 'copy URL to clipboard' popup and RHN on single ESC click

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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.11.2
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

Recording.520.mp4
on.esc.app.closes.both.RHN.and.copy.popup.mp4

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f4c841961ae2e365
  • Upwork Job ID: 1656822582847545344
  • Last Price Increase: 2023-05-12
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 7, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 7, 2023

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

@melvin-bot
Copy link

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

@huzaifa-99
Copy link
Contributor

huzaifa-99 commented May 8, 2023

Proposal

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

We are trying to handle the escape key in a priority order. So the last modal opened should be the first one closed.

What is the root cause of that problem?

The problem is related to the whole right side modal, any open context menu will be closed along with the right side modal itself on escape press.

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

When escape is pressed, we should check if the context menu is open and if it is we should prevent the modal from closing. There are 2 approaches to this

Approach 1: Global changes (Suggested)

We can update the PopoverReportActionContextMenu and add a new method

isVisible() {
    return this.state.isPopoverVisible
}

and also add it to ReportActionContextMenu

function isVisible() {
    return contextMenuRef.current.isVisible();
}

Now in the ScreenWrapper we can check if the context menu is visible and prevent escape on the modal if it is here

if (this.props.modal.willAlertModalBecomeVisible) {

by updating it with this

if (this.props.modal.willAlertModalBecomeVisible || ReportActionContextMenu.isVisible()) {

This will correctly handle the escape listener.

Additionally instead of just passing the visible state we can pass the current state from the ReportActionContextMenu

function getCurrentState() {
    return contextMenuRef.current.getCurrentState();
}

so we can use this for much more conditional checks.

Important: The above changes will focus the Help menu item with a blue border when escape is pressed, if we want to prevent that we also blur the menu item on escape (DomUtils.blurActiveElement()).

Approach 2: Local changes

We do local updates to the InitialSettingsPage to check if the context menu is open, so replacing this line

onSecondaryInteraction={!_.isEmpty(item.link) ? e => ReportActionContextMenu.showContextMenu(CONTEXT_MENU_TYPES.LINK, e, item.link, this.popoverAnchor.current) : undefined}

with

onSecondaryInteraction={!_.isEmpty(item.link) ? e => {
    return ReportActionContextMenu.showContextMenu(
        CONTEXT_MENU_TYPES.LINK,
        e,
        item.link,
        this.popoverAnchor.current,
        '0',
        {},
        '',
        () => { /* context menu got opened: store bool in state */ },
        () => { /* context menu got closed: update bool in state */},
    )
} : undefined}

and store state value for when context menu is opened/closed.

Next we add a new prop preventDismissOnEscKey on the ScreenWrapper and in the escape key press listener here

if (this.props.modal.willAlertModalBecomeVisible) {

we update the condition to check if we should prevent escape key from closing the modal

if (this.props.modal.willAlertModalBecomeVisible || this.props.preventDismissOnEscKey) {
   return
   // ...

Finally we have to pass the prop from the InitialSettingsPage

<ScreenWrapper 
    includeSafeAreaPaddingBottom={false} 
    preventDismissOnEscKey={ /* here we pass the state value stored earlier */ }
>

What alternative solutions did you explore? (Optional)

N/A

@mallenexpensify
Copy link
Contributor

@dhanashree-sawant and/or @huzaifa-99 , can you please document all areas of the app where this is happening so we can fix them at one time? I see two more instances here
image

@dhanashree-sawant
Copy link

HI @mallenexpensify, Sure will go through it and let you know all the instances.

@huzaifa-99
Copy link
Contributor

huzaifa-99 commented May 10, 2023

@mallenexpensify, @dhanashree-sawant I was able to find these

  1. In /settings/about/app-download-links (all 3 of these links have a popover)

image

  1. In /settings/about, 'View the code' and 'View open jobs' have a popover

image

  1. In get-assistance/:taskId ex: get-assistance/16247, 'Explore help docs' has a popover

image

  1. Also the 'help' link on the settings page has a popover (the original bug report)

All of these can be fixed by the Approach 1 suggested in this proposal.

@dhanashree-sawant
Copy link

Few more instances of the issue which @huzaifa-99 missed:

  1. In settings page, help link
    image
  2. In settings->workspaces->any workspace->Reimburse expenses->View all receipts link
    image
  3. In settings->workspaces->any workspace->Pay bills->View all bills link
    image
  4. In settings->workspaces->any workspace->Send invoices-> send invoice link and view all invoices link
    image

@huzaifa-99
Copy link
Contributor

huzaifa-99 commented May 10, 2023

Thanks for spotting @dhanashree-sawant.

@mallenexpensify I did a quick test against the newly spotted areas, and Approach 1 in this proposal also works there.

@melvin-bot melvin-bot bot added the Overdue label May 11, 2023
@mallenexpensify mallenexpensify added the External Added to denote the issue can be worked on by a contributor label May 12, 2023
@melvin-bot melvin-bot bot changed the title On click of ESC while 'copy URL to clipboard' popup is open, app closes both 'copy URL to clipboard' popup and RHN [$1000] On click of ESC while 'copy URL to clipboard' popup is open, app closes both 'copy URL to clipboard' popup and RHN May 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 12, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 12, 2023

Current assignee @mallenexpensify is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented May 12, 2023

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

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

melvin-bot bot commented May 12, 2023

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

@mallenexpensify
Copy link
Contributor

Thanks @huzaifa-99 and @dhanashree-sawant , teamwork!!!
@s77rt , can you please review?

@allroundexperts
Copy link
Contributor

My proposal here solves this issue by actually fixing the root cause.

@s77rt
Copy link
Contributor

s77rt commented May 12, 2023

@huzaifa-99 Thanks for the proposal. I don't think your RCA is complete. It seems that you are treating this bug as a feature request but it's actually a bug, the feature is already implemented on ScreenWrapper.

@s77rt
Copy link
Contributor

s77rt commented May 12, 2023

@allroundexperts Thanks for the proposal. Your RCA is correct; We are missing the case where the modal is initially rendered visible. The suggested fix makes sense; Cover that case by calling willAlertModalBecomeVisible on componentDidMount.

I just have a non-blocking question, what cases would it cover calling willAlertModalBecomeVisible on componentWillUnmount.

🎀 👀 🎀 C+ reviewed
cc @techievivek

And please copy the proposal from the other issue to this for visibility.

@allroundexperts
Copy link
Contributor

Thanks for your review @s77rt. componentWillUnmount will cover all the cases where we're controlling the modal visibility by mounting / un-mounting the component.

@s77rt
Copy link
Contributor

s77rt commented May 12, 2023

@allroundexperts Yeah I got the idea. I'm asking if you can pinpoint a real existing case. I'm asking because although we mostly have 1 visible modal at a time, we may have n rendered modal at a time. If we are going to call willAlertModalBecomeVisible on componentWillUnmount we need to make sure that the modal getting unmounted was actually visible.

@allroundexperts
Copy link
Contributor

@allroundexperts Yeah I got the idea. I'm asking if you can pinpoint a real existing case. I'm asking because although we mostly have 1 visible modal at a time, we may have n rendered modal at a time. If we are going to call willAlertModalBecomeVisible on componentWillUnmount we need to make sure that the modal getting unmounted was actually visible.

@s77rt I'm not sure if I am following your question exactly but I'll take a shot. Even the context menu (as in this bug) is a real case. Without the function in unmount, when you'll press escape, the modal will close. But pressing it again won't close the RHN, since the willAlertModalBecomeVisible will be true even after unmount.

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

melvin-bot bot commented May 15, 2023

📣 @allroundexperts You have been assigned to this job by @techievivek!
Please apply to this job in Upwork 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 📖

@techievivek
Copy link
Contributor

Not overdue. Job has been assigned to @allroundexperts

@melvin-bot melvin-bot bot removed the Overdue label May 15, 2023
@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label May 15, 2023
@allroundexperts
Copy link
Contributor

PR created #18982

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels May 18, 2023
@melvin-bot melvin-bot bot changed the title [$1000] On click of ESC while 'copy URL to clipboard' popup is open, app closes both 'copy URL to clipboard' popup and RHN [HOLD for payment 2023-05-25] [$1000] On click of ESC while 'copy URL to clipboard' popup is open, app closes both 'copy URL to clipboard' popup and RHN May 18, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 18, 2023

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

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

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 May 18, 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:

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

@s77rt
Copy link
Contributor

s77rt commented May 18, 2023


Regression Test Proposal

  1. Open App
  2. Go to Settings
  3. Right click on "Help"
  4. Verify a modal popover is shown
  5. Press ESC
  6. Verify the modal is closed but the Settings page is still shown
  7. Press ESC
  8. Verify the Settings page is closed

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 24, 2023
@mallenexpensify
Copy link
Contributor

@s77rt , @allroundexperts , @dhanashree-sawant can you please accept the job and reply here once you have?
https://www.upwork.com/jobs/~01f4c841961ae2e365

@s77rt
Copy link
Contributor

s77rt commented May 26, 2023

@mallenexpensify Accepted!

@dhanashree-sawant
Copy link

Thanks @mallenexpensify, Accepted the offer.

@allroundexperts
Copy link
Contributor

@s77rt , @allroundexperts , @dhanashree-sawant can you please accept the job and reply here once you have? https://www.upwork.com/jobs/~01f4c841961ae2e365

@mallenexpensify Accepted.

@melvin-bot melvin-bot bot added the Overdue label May 29, 2023
@techievivek
Copy link
Contributor

Not overdue, we are waiting for the payment to complete.

@melvin-bot melvin-bot bot removed the Overdue label May 30, 2023
@mallenexpensify
Copy link
Contributor

@dhanashree-sawant paid $250 for reporting, @s77rt and @allroundexperts paid $1500, including the 50% timeliness bonus.

TestRail update GH

Thanks all!

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

7 participants