-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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-11-04] Pressing Escape on the confirmation modal while removing a Member closes both modals - @parasharrajat #5769
Comments
Triggered auto assignment to @cead22 ( |
ProposalI tried many ways to intercept the Escape key but Modal App/src/components/Modal/BaseModal.js Lines 77 to 79 in 7fac08c
So the best solution so far is to Block the close of a page when Modal is shown over the screen. which should be the case. For example, on any screen if a user has done some action and a confirmation modal is shown then escape key should only interact with that Modal not other parts of the app. Solution
this.unsubscribeEscapeKey = KeyboardShortcut.subscribe('Escape', () => {
if (!this.props.modal.isVisible) {
Navigation.dismissModal();
}
}, [], true);
withOnyx({
modal: {
key: ONYXKEYS.MODAL,
},
}), |
Triggered auto assignment to @kadiealexander ( |
Upwork job: https://www.upwork.com/jobs/~017d9eada7d9235f63 |
Triggered auto assignment to @Julesssss ( |
I dont know what css framework you are using, but a lot of them don’t allow stacked modals. Workaround is to wrap the modals and disable keyboard input, input will then be handled individually by the modals. Don’t have an up work account I’m afraid :/ |
Proposed Fix: Have a ref for each of the modals to track the active/topmost modal, listen to keyboard event on the escape key and dismiss modal based on the most recent modal ref. |
Thanks for the proposals! I prefer @parasharrajat's solution, as it's simpler and more self-contained than tracking recent modal state. Would you like to go ahead with this? This is out of scope for now, but it made me wonder if it would be worthwhile to give all pages/Modals the ability to be lifecycle aware. Having callbacks for becoming active (top-level) and inactive (when another Modal/Page is opened on top) would allow us to be subscribed to the Escape key ONLY when it should be closable. |
So.
it means we don't need to handle anything for now. @Julesssss |
Deployed to staging, waiting for production deployment. Begone, Melvin. |
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.1.10-2 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-11-04. 🎊 |
@parasharrajat sorry I hadn't sent the Upwork hire! Please let me know when this is accepted and I'll pay it out asap. :) |
@kadiealexander Done. |
Paid @parasharrajat , inc. reporting and |
Thanks for grabbing this on my weekend @mallenexpensify!! |
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:
Expected Result:
Only the remove modal should be dismissed
Actual Result:
Both the remove modal and the right panel are dismissed
Workaround:
Don't press the escape button in the modal.
Platform:
Where is this issue occurring?
Version Number: 1.1.7-3
Reproducible in staging?: Yes
Reproducible in production?: Yes
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Recording.224.mp4
Expensify/Expensify Issue URL:
Issue reported by: @parasharrajat
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1633962922114200
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: