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 2021-10-30] Esc key doesn't dismiss any of the ConfirmModal around the app #5158

Closed
isagoico opened this issue Sep 9, 2021 · 34 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@isagoico
Copy link

isagoico commented Sep 9, 2021

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


Action Performed:

  1. Navigate to a user.
  2. Add an attachment more than 50 MB.
  3. Expect "attachment too large" warning to pop up.
  4. Press Escape key.

Expected Result:

Escape should close the ConfirmModal

Actual Result:

Escape doesn't do anything.

Workaround:

User has to close the modal manually

Platform:

Where is this issue occurring?

  • Web
  • Desktop App

Version Number: 1.0.95-0

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation
image

Upwork Job URL: https://www.upwork.com/jobs/~01ae467f5cc80cb019

Issue reported by: @rushatgabhane
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1631136254079800

View all open jobs on GitHub

@MelvinBot
Copy link

Triggered auto assignment to @TomatoToaster (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@parasharrajat
Copy link
Member

parasharrajat commented Sep 9, 2021

Sorry for pitching in but IMO ConfirmModal should not be escaped. Their purpose is to be confirmed by the user so whatever action is mentioned on the modal should be confirmed by the user.

In this case User should click close. In other cases for example when money is transferred and the user is asked to confirm something, he should choose among the presented buttons.


Or we can change this behavior. 😸

@TomatoToaster
Copy link
Contributor

Hmm I'm personally fine with it escaping the modal with escape key. Let's ping the room and see if we can get a larger consensus on this before implementing it.

@TomatoToaster
Copy link
Contributor

Ok I think the accessibility case (mentioned in slack) is a good enough case. I'm going to make this external officially.

@TomatoToaster TomatoToaster added the External Added to denote the issue can be worked on by a contributor label Sep 9, 2021
@MelvinBot
Copy link

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

@MelvinBot MelvinBot added Weekly KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors and removed Daily KSv2 labels Sep 9, 2021
@MelvinBot
Copy link

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

@parasharrajat
Copy link
Member

Proposal

  1. For the specific case of AttachmentModal we just need to pass the onCancel Callback which is called on the press of ESC.
    onConfirm={this.closeConfirmModal}
                    onCancel={this.closeConfirmModal}

  1. For other confimModals, we can quickly run a search to find all instances of ConfirmModal and attach the callback to reset the isVisible prop of ConfirmModal to its onCancal Callback.

@rushatgabhane
Copy link
Member

rushatgabhane commented Sep 10, 2021

onCancel={this.closeConfirmModal}

@parasharrajat you wanna pass an additional prop to ConfirmModal? But that'd also add an extra button which isn't needed.

Also, we'll have to define and pass a callback everytime we use ConfirmModal. This is not very "DRY".

Do you think we can do better? So that this behaviour is built-in for the component?

Maybe something with the help of navigation.

@parasharrajat
Copy link
Member

Ahh, I didn't see it through that it will render the button. Absolutely, we can inbuild it in the ConfirmModal if we just want to hide every ConfirmModal. I will update the Proposal to add that as well.

@parasharrajat
Copy link
Member

I just checked onCancel does not show an extra button until shouldShowCancelButton is true but You made a good point that we can just push this code inside the ConfirmModal.

@rushatgabhane
Copy link
Member

I just checked onCancel does not show an extra button until shouldShowCancelButton is true but You made a good point that we can just push this code inside the ConfirmModal.

Ohh okay, sounds good!

@parasharrajat
Copy link
Member

parasharrajat commented Sep 10, 2021

If I do this:

  1. If we want to close all confirmModals when Esc is pressed and don't want to manage it from the Parent Component. Then we can

    a. Add a state property isVisible and using componentDidupdate, Update this state property when isVisible prop changes.

    b. Then set the isVisible prop of Modal component to this.state.isVisible and set this state prop to false on onClose callback.

    <Modal
        onClose={() => {
			this.setState({isVisible: false});
            props.onCancel();
        });
        isVisible={this.state.isVisible}
        type={props.isSmallScreenWidth
            ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED
            : CONST.MODAL.MODAL_TYPE.CONFIRM}
    >

There is an issue with this @rushatgabhane. As ConfirmModal is controlled by the isVisible state of the parent component, we have to set it to false whenever the modal is closed. Otherwise, next time, ConfirmModal will not be shown as isVisible was already true.

e.g.

 onCancel={this.closeConfirmModal}

is necessary.

Then we still need to pass a callback to reset the parent Component state. Thus my first proposal stands correct.

Can you think of a way to mitigate this? If so, let me know.

@rushatgabhane
Copy link
Member

rushatgabhane commented Sep 10, 2021

@parasharrajat I get why it's a problem. And I don't have a better solution.

I'll throw some ideas, but I don't want to waste your time.

Umm some clever design pattern could do the trick.
Or, instead of using a prop to make it visible, navigate to the modal so you can "go back".
Onyx?

@Luke9389
Copy link
Contributor

We will loop back around to this after the n6-hold is lifted

@MelvinBot MelvinBot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 11, 2021
@trjExpensify
Copy link
Contributor

Hired.

@trjExpensify
Copy link
Contributor

Not overdue. Awaiting deploy to prod.

@MelvinBot MelvinBot removed the Overdue label Oct 19, 2021
@botify botify added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 23, 2021
@botify botify changed the title Esc key doesn't dismiss any of the ConfirmModal around the app [HOLD for payment 2021-10-30] Esc key doesn't dismiss any of the ConfirmModal around the app Oct 23, 2021
@botify
Copy link

botify commented Oct 23, 2021

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.1.8-9 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 2021-10-30. 🎊

@rushatgabhane
Copy link
Member

Just curious, do I have to apply somewhere for issue reporting bonus?

@Luke9389
Copy link
Contributor

Luke9389 commented Nov 2, 2021

Just curious, do I have to apply somewhere for issue reporting bonus?

@rushatgabhane Nope! We'll pay you when we pay the author of the PR. I think there's been a slight hold up here because @trjExpensify (the Contributor Manager on this issue) has been Out Of Office. He comes back tomorrow, and I'm sure the payment will be processed at that time. Sorry for the delay!

@MelvinBot MelvinBot removed the Overdue label Nov 2, 2021
@laurenreidexpensify
Copy link
Contributor

@parasharrajat you're now paid - thanks for patience - Tom was taking some well deserved OOO and this slipped through the net!

@rushatgabhane i've hired you for the job in upwork, as soon you accept I'll end the contract and get you paid tomorrow. Thanks!

@laurenreidexpensify
Copy link
Contributor

@rushatgabhane paid! Thanks!

@Luke9389
Copy link
Contributor

Luke9389 commented Nov 2, 2021

@laurenreidexpensify to the rescue! Thanks!

@rushatgabhane
Copy link
Member

@laurenreidexpensify Appreciate it! Thank you!

@parasharrajat
Copy link
Member

Hey, @laurenreidexpensify I was expecting the N6 bonus.

@laurenreidexpensify
Copy link
Contributor

Ah sorry Rajat - will hook you up now!

@laurenreidexpensify
Copy link
Contributor

Done!

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

10 participants