Skip to content

Commit 3c74ad6

Browse files
Merge pull request #357 from microsoft/psl-bug36192-cm
fix: Error message does not auto-dismiss and close (X) icon is missing when uploading unsupported file
2 parents 507be23 + 87ce2d0 commit 3c74ad6

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/frontend/src/components/uploadButton.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,17 @@ const FileUploadZone: React.FC<FileUploadZoneProps> = ({
387387
}
388388
}, [fileLimitExceeded]);
389389

390+
// Auto-hide file rejection errors after 10 seconds
391+
useEffect(() => {
392+
if (fileRejectionErrors.length > 0) {
393+
const timer = setTimeout(() => {
394+
setFileRejectionErrors([]);
395+
}, 5000);
396+
397+
return () => clearTimeout(timer);
398+
}
399+
}, [fileRejectionErrors]);
400+
390401
return (
391402
<div style={{ width: '100%', minWidth: '720px', maxWidth: '800px', margin: '0 auto', marginTop: '0', padding: '16px', paddingBottom: '60px' }}>
392403
<ConfirmationDialog
@@ -562,12 +573,14 @@ const FileUploadZone: React.FC<FileUploadZoneProps> = ({
562573
)}
563574
</div>
564575

565-
<div style={{ display: 'flex', flexDirection: 'column', gap: '13px', width: '837px', paddingBottom: 10, borderRadius: '4px', }}>
576+
<div style={{ display: 'flex', flexDirection: 'column', gap: '13px', width: '880px', paddingBottom: 10, borderRadius: '4px', }}>
566577
{/* Show file rejection errors for invalid type or size */}
567578
{fileRejectionErrors.length > 0 && (
568579
<MessageBar
569580
messageBarType={MessageBarType.error}
570581
isMultiline={true}
582+
onDismiss={() => setFileRejectionErrors([])}
583+
dismissButtonAriaLabel="Close"
571584
styles={messageBarErrorStyles}
572585
>
573586
<div style={{ display: "flex", alignItems: "center" }}>

0 commit comments

Comments
 (0)