Skip to content

Fix image upload modal cancel loop #1755

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

Merged
merged 8 commits into from
Sep 7, 2023
Merged

Fix image upload modal cancel loop #1755

merged 8 commits into from
Sep 7, 2023

Conversation

david-crespo
Copy link
Collaborator

@david-crespo david-crespo commented Sep 6, 2023

Fixes #1745. Will make a separate issue for the remaining part of the problem.

I believe the issue is due to both the click outside and focus outside triggering onDismiss, which triggers the confirm(). My theory so far is that when you cancel out of the confirm, focus returns to the dismissable layer overlay, which triggers onFocusOutside again.

This change fixes the infinite loop of confirms that fully breaks the page, but it does not fix the double confirm when you click elsewhere (this is shown at the end of the recording). Another issue shown in the recording is that when you click the background over the inputs in the side modal, it seems to focus them. This may be directly caused by the preventDefault. In any case, it's an improvement on the current broken state.

2023-09-06-modal-loop-fix

@vercel
Copy link

vercel bot commented Sep 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Sep 7, 2023 4:24pm

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has totally checked 620 files.

Valid Invalid Ignored Fixed
567 1 52 0
Click to see the invalid file list
  • app/forms/modal-loop.tsx

@@ -0,0 +1,30 @@
import { useState } from 'react'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { useState } from 'react'
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* Copyright Oxide Computer Company
*/
import { useState } from 'react'

@david-crespo
Copy link
Collaborator Author

I need a break from Safari failing my E2Es before I throw my computer out the window. But I will fix it.

@david-crespo david-crespo merged commit bb43635 into main Sep 7, 2023
@david-crespo david-crespo deleted the modal-cancel-loop branch September 7, 2023 16:44
david-crespo added a commit to oxidecomputer/omicron that referenced this pull request Sep 7, 2023
oxidecomputer/console@bfb680e...af6536d

* [af6536d5](oxidecomputer/console@af6536d5) skip one flaky test in safari ugh
* [84b5177b](oxidecomputer/console@84b5177b) Add full commit range to omicron PR body (oxidecomputer/console#1759)
* [26737fd8](oxidecomputer/console@26737fd8) bump pinned omicron to latest
* [81e38209](oxidecomputer/console@81e38209) Tweak playwright config (oxidecomputer/console#1758)
* [6582b247](oxidecomputer/console@6582b247) increase timeout for image upload error check
* [e2147840](oxidecomputer/console@e2147840) Revert mistake commit "curious what it does when we don't say anything"
* [7530c3da](oxidecomputer/console@7530c3da) curious what it does when we don't say anything
* [bb436357](oxidecomputer/console@bb436357) Fix image upload modal cancel loop (oxidecomputer/console#1755)
* [e1558785](oxidecomputer/console@e1558785) add lint-fast npm script
* [4614fe6f](oxidecomputer/console@4614fe6f) Fix oxidecomputer/console#1652 - Listbox popover does not move when page scrolls (oxidecomputer/console#1747)
* [14685b11](oxidecomputer/console@14685b11) Upgrade playwright eslint plugin to get new rules (oxidecomputer/console#1752)
* [2b3d519d](oxidecomputer/console@2b3d519d) Add loading state to ok button in confirm delete modal (oxidecomputer/console#1750)
* [0895081b](oxidecomputer/console@0895081b) update readme to reflect RFDs now public
* [be687595](oxidecomputer/console@be687595) Bump TS 5.2, Zod, and other deps (oxidecomputer/console#1749)
david-crespo added a commit to oxidecomputer/omicron that referenced this pull request Sep 7, 2023
UI changes:

* [bb436357](oxidecomputer/console@bb436357)
oxidecomputer/console#1755
* [4614fe6f](oxidecomputer/console@4614fe6f)
oxidecomputer/console#1747
* [2b3d519d](oxidecomputer/console@2b3d519d)
oxidecomputer/console#1750

All changes:
oxidecomputer/console@bfb680e...af6536d

* [af6536d5](oxidecomputer/console@af6536d5)
skip one flaky test in safari ugh
* [84b5177b](oxidecomputer/console@84b5177b)
oxidecomputer/console#1759
* [26737fd8](oxidecomputer/console@26737fd8)
bump pinned omicron to latest
* [81e38209](oxidecomputer/console@81e38209)
oxidecomputer/console#1758
* [6582b247](oxidecomputer/console@6582b247)
increase timeout for image upload error check
* [e2147840](oxidecomputer/console@e2147840)
Revert mistake commit "curious what it does when we don't say anything"
* [7530c3da](oxidecomputer/console@7530c3da)
curious what it does when we don't say anything
* [bb436357](oxidecomputer/console@bb436357)
oxidecomputer/console#1755
* [e1558785](oxidecomputer/console@e1558785)
add lint-fast npm script
* [4614fe6f](oxidecomputer/console@4614fe6f)
oxidecomputer/console#1747
* [14685b11](oxidecomputer/console@14685b11)
oxidecomputer/console#1752
* [2b3d519d](oxidecomputer/console@2b3d519d)
oxidecomputer/console#1750
* [0895081b](oxidecomputer/console@0895081b)
update readme to reflect RFDs now public
* [be687595](oxidecomputer/console@be687595)
oxidecomputer/console#1749
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cancel modal loop
1 participant