Skip to content

Commit 7bc4cb3

Browse files
Merge pull request #1692 from yannikreiter-maxworx/issue-1679
Fix click behavior in ListItemAttachments component
2 parents ca1f3ce + f4b1e77 commit 7bc4cb3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/controls/listItemAttachments/ListItemAttachments.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ export class ListItemAttachments extends React.Component<IListItemAttachmentsPro
267267
this.state.attachments.map(file => {
268268
const fileName = file.FileName;
269269
const previewImage = this.previewImages[fileName];
270+
const clickDisabled = !this.state.itemId;
270271
return (
271272
<div key={fileName} className={styles.documentCardWrapper}>
272273
<TooltipHost
@@ -276,8 +277,8 @@ export class ListItemAttachments extends React.Component<IListItemAttachmentsPro
276277
directionalHint={DirectionalHint.rightCenter}>
277278

278279
<DocumentCard
279-
onClickHref={!openAttachmentsInNewWindow && `${file.ServerRelativeUrl}?web=1`}
280-
onClick={openAttachmentsInNewWindow && (() => window.open(`${file.ServerRelativeUrl}?web=1`, "_blank"))} // JJ - 20200613 - needed to support Microsoft Teams
280+
onClickHref={!clickDisabled && !openAttachmentsInNewWindow && `${file.ServerRelativeUrl}?web=1`}
281+
onClick={!clickDisabled && openAttachmentsInNewWindow && (() => window.open(`${file.ServerRelativeUrl}?web=1`, "_blank"))} // JJ - 20200613 - needed to support Microsoft Teams
281282
className={styles.documentCard}>
282283
<DocumentCardPreview previewImages={[previewImage]} />
283284
<Label className={styles.fileLabel}>{fileName}</Label>

0 commit comments

Comments
 (0)