Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Disable backdrop clicks

Manav Rathif46f063bebc9
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index 5831e348e5..1ec31eaf78 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -44,6 +44,7 @@ import {
Link,
Stack,
Typography,
+ type DialogProps,
} from "@mui/material";
import { t } from "i18next";
import { GalleryContext } from "pages/gallery";
@@ -1133,10 +1134,22 @@ const UploadTypeSelector: React.FC<UploadTypeSelectorProps> = ({
}
}, [open]);
+ const handleClose: DialogProps["onClose"] = (_, reason) => {
+ // Disable backdrop clicks and esc keypresses if a selection is pending
+ // processing so that the user doesn't inadvertently close the dialog.
+ if (
+ pendingUploadType &&
+ (reason == "backdropClick" || reason == "escapeKeyDown")
+ ) {
+ return;
+ }
+ onClose();
+ };
+
return (
<Dialog
open={open}
- onClose={onClose}
+ onClose={handleClose}
fullWidth
slotProps={{
paper: {