From 9a431a873b8c7569df174d2759e165b041d27fd3 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Sun, 17 May 2026 16:49:13 +0200 Subject: [PATCH] fix: close attachment preview when clicking outside content --- components/files/file-preview-modal.tsx | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/components/files/file-preview-modal.tsx b/components/files/file-preview-modal.tsx index 31df9063..848975f0 100644 --- a/components/files/file-preview-modal.tsx +++ b/components/files/file-preview-modal.tsx @@ -182,7 +182,7 @@ export function FilePreviewModal({ name, onClose, onDownload, getFileContent }: -
e.stopPropagation()}> +
{loading && (
@@ -194,13 +194,19 @@ export function FilePreviewModal({ name, onClose, onDownload, getFileContent }: )} {!loading && !error && (fileType === "text") && content !== null && ( -
+          
 e.stopPropagation()}
+          >
             {content}
           
)} {!loading && !error && fileType === "markdown" && content !== null && ( -
+
e.stopPropagation()} + >
)} @@ -211,6 +217,7 @@ export function FilePreviewModal({ name, onClose, onDownload, getFileContent }: alt={name} className="max-w-full max-h-full object-contain rounded-lg bg-background" draggable={false} + onClick={(e) => e.stopPropagation()} /> )} @@ -220,6 +227,7 @@ export function FilePreviewModal({ name, onClose, onDownload, getFileContent }: sandbox="" className="w-full max-w-5xl h-full rounded-lg bg-white" title={name} + onClick={(e) => e.stopPropagation()} /> )} @@ -229,6 +237,7 @@ export function FilePreviewModal({ name, onClose, onDownload, getFileContent }: type="application/pdf" className="w-full max-w-5xl h-full rounded-lg bg-white" aria-label={name} + onClick={(e) => e.stopPropagation()} >