From f4b1e773a81f1433e7fc645c123a809cfc00fe32 Mon Sep 17 00:00:00 2001 From: Yannik Reiter Date: Fri, 3 Nov 2023 14:23:43 +0100 Subject: [PATCH] Fix click behavior in ListItemAttachments component --- src/controls/listItemAttachments/ListItemAttachments.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controls/listItemAttachments/ListItemAttachments.tsx b/src/controls/listItemAttachments/ListItemAttachments.tsx index 123109150..64e469ed8 100755 --- a/src/controls/listItemAttachments/ListItemAttachments.tsx +++ b/src/controls/listItemAttachments/ListItemAttachments.tsx @@ -267,6 +267,7 @@ export class ListItemAttachments extends React.Component { const fileName = file.FileName; const previewImage = this.previewImages[fileName]; + const clickDisabled = !this.state.itemId; return (
window.open(`${file.ServerRelativeUrl}?web=1`, "_blank"))} // JJ - 20200613 - needed to support Microsoft Teams + onClickHref={!clickDisabled && !openAttachmentsInNewWindow && `${file.ServerRelativeUrl}?web=1`} + onClick={!clickDisabled && openAttachmentsInNewWindow && (() => window.open(`${file.ServerRelativeUrl}?web=1`, "_blank"))} // JJ - 20200613 - needed to support Microsoft Teams className={styles.documentCard}>