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

Workspace - Esc key does not close the opened window when 3 dot menu is open #49802

Open
1 of 6 tasks
lanitochka17 opened this issue Sep 26, 2024 · 21 comments
Open
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Sep 26, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.40-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: N/A
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team

Action Performed:

  1. Log in to any account
  2. Go to setting> Workspace> Select a workspace > Members
  3. Click on the 3 dot menu and hover over it.
  4. Press "Ctrl + D"
  5. Press "esc" key
    You might need to repeat step 3-5

Expected Result:

Opened window is dismissed

Actual Result:

Opened window is not dismissed. And page is navigated to workspace page with out dismissing the window

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

Add any screenshot/video evidence

Bug6615895_1727344310082.Screen_Recording_2024-09-26_at_12.29.17_in_the_afternoon.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 26, 2024
Copy link

melvin-bot bot commented Sep 26, 2024

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

@codewaseem
Copy link

I could not reproduce this on the latest main branch.

@rijusougata13
Copy link

This issue has been resolved. Please close this one.

@melvin-bot melvin-bot bot added the Overdue label Sep 28, 2024
Copy link

melvin-bot bot commented Sep 28, 2024

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

@rijusougata13
Copy link

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link:

Copy link

melvin-bot bot commented Sep 28, 2024

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

@bernhardoj
Copy link
Contributor

Proposal

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

ESC shortcut doesn't close the Debug modal/page.

What is the root cause of that problem?

Every modal when mounted will set a "close modal" function that can be used to close the modal.

removeOnCloseListener = Modal.setCloseModal(onClose);
}
return () => {
if (!removeOnCloseListener) {
return;
}
removeOnCloseListener();
};
}, [isVisible, wasVisible, onClose, type]);

If we press ESC, Modal.closeTop will be called which will call the last/top "close modal" function if exists and then remove it from the list. But sometimes, the "close modal" is empty, thus the Debug modal is never closed.

function closeTop() {
if (closeModals.length === 0) {
return;
}
if (onModalClose) {
closeModals[closeModals.length - 1](isNavigate);
closeModals.pop();
return;
}
closeModals[closeModals.length - 1]();
closeModals.pop();
}

Another way for the "close modal" function to be removed is when the modal is unmounted which is shown by the first permalink above.

function setCloseModal(onClose: () => void) {
if (!closeModals.includes(onClose)) {
closeModals.push(onClose);
}
return () => {
const index = closeModals.indexOf(onClose);
if (index === -1) {
return;
}
closeModals.splice(index, 1);
};
}

The Debug modal is placed inside a ScreenWrapper, which means every screen has the modal mounted.

<TestToolsModal />

In this issue, when we press ESC, the workspace members list page is closed because the dismissModal here is called which closes a FullScreenNavigator. However, dismissModal shouldn't be called here because a modal is visible.

() => {
if (modal.current.willAlertModalBecomeVisible) {
return;
}
if (modal.current.disableDismissOnEscape) {
return;
}
Navigation.dismissModal();
},

But in our case, willAlertModalBecomeVisible is false even though the modal is visible. willAlertModalBecomeVisible is updated every time a modal/popover is shown/hidden.

const hideModal = useCallback(
(callHideCallback = true) => {
if (Modal.areAllModalsHidden()) {
Modal.willAlertModalBecomeVisible(false);

if (isVisible) {
Modal.willAlertModalBecomeVisible(true, type === CONST.MODAL.MODAL_TYPE.POPOVER || type === CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED);

Modal.willAlertModalBecomeVisible(isVisible, true);

In this issue, we first open a popover of the member list and then press the Debug modal shortcut. Sometimes, the Debug modal is shown first which sets the willAlertModalBecomeVisible and then followed by the popover hide which sets the willAlertModalBecomeVisible to false.

Because of that, pressing the ESC will close the workspace members page which unmounts the Debug modal which removes the "close modal" function from the list, so the ESC shortcut doesn't close the Debug modal because the "close modal" list is now empty.

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

To fix that, we need to wait for any modal to close first before showing the debug modal.

const unsubscribeDebugShortcut = KeyboardShortcut.subscribe(
debugShortcutConfig.shortcutKey,
() => {
toggleTestToolsModal();
},

Modal.close(toggleTestToolsModal);

Also, we can consider moving the Debug modal (TestToolsModal) from ScreenWrapper to AuthScreens. This way, we won't render the modal on every screen.

Before:

image

After:
image

@OfstadC
Copy link
Contributor

OfstadC commented Oct 1, 2024

This is no longer reproducible - closing

@OfstadC OfstadC closed this as completed Oct 1, 2024
@melvin-bot melvin-bot bot removed the Overdue label Oct 1, 2024
@bernhardoj
Copy link
Contributor

@OfstadC this is still reproducible

@OfstadC
Copy link
Contributor

OfstadC commented Oct 1, 2024

@bernhardoj

Esc is working for me
2024-10-01_08-29-45 (1)

@bernhardoj
Copy link
Contributor

@OfstadC you missed this step.

Click on the 3 dot menu and hover over it.

web.mp4

@OfstadC
Copy link
Contributor

OfstadC commented Oct 1, 2024

@OfstadC you missed this step.

🤦‍♀️

@OfstadC OfstadC reopened this Oct 1, 2024
@OfstadC
Copy link
Contributor

OfstadC commented Oct 1, 2024

Thanks @bernhardoj !

@parasharrajat
Copy link
Member

We are discussing to solve this issue with #49976. Its not yet decided yet. In that case, @OfstadC could you please assign me as C+ here?

@parasharrajat
Copy link
Member

parasharrajat commented Oct 3, 2024

Ok. Thanks. @bernhardoj's proposal looks good to me. let's make that change. This proposal will also solve #49976

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Oct 3, 2024

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

@parasharrajat
Copy link
Member

@OfstadC We are missing the help wanted label. Let's apply that before hiring anyone for automation sake. Thanks.

@OfstadC OfstadC added the External Added to denote the issue can be worked on by a contributor label Oct 3, 2024
Copy link

melvin-bot bot commented Oct 3, 2024

Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

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

melvin-bot bot commented Oct 3, 2024

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

@marcochavezf
Copy link
Contributor

Thanks for the review @parasharrajat, assigning @bernhardoj 🚀

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 4, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Oct 5, 2024
@bernhardoj
Copy link
Contributor

PR is ready
cc: @parasharrajat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants