mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-02 16:15:39 +00:00
fix: say whether a conversation attachment button previews or downloads, next to the file name
This commit is contained in:
@@ -67,7 +67,7 @@ describe('conversation controls name their target', () => {
|
||||
hasAttachment: true,
|
||||
attachments: [{ partId: '2', blobId: 'blob2', name: 'report.pdf', type: 'application/pdf', size: 2048 }],
|
||||
})]);
|
||||
expect(screen.getByRole('button', { name: /^email_viewer\.(download|preview)_named \{"name":"report\.pdf"\}$/ })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /^(email_viewer\.download|files\.preview) report\.pdf/ })).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1013,10 +1013,12 @@ export function ConversationEmailBody({
|
||||
onDownloadAttachment?.(attachment.blobId, attachment.name || 'attachment', attachment.type, source);
|
||||
}}
|
||||
title={opensPreview ? t('files.preview') : t('email_viewer.download')}
|
||||
aria-label={t(opensPreview ? 'email_viewer.preview_named' : 'email_viewer.download_named', { name: attachment.name ? stripBidiControls(attachment.name) : 'Attachment' })}
|
||||
className="flex items-center gap-2 px-3 py-2 rounded-lg bg-muted hover:bg-muted/80 transition-colors text-sm"
|
||||
>
|
||||
<Icon className="w-4 h-4 text-muted-foreground" />
|
||||
{/* The action, for screen readers: the visible name alone
|
||||
doesn't say whether the button previews or downloads. */}
|
||||
<span className="sr-only">{opensPreview ? t('files.preview') : t('email_viewer.download')}</span>{' '}
|
||||
<span className="truncate max-w-[150px]">{attachment.name ? stripBidiControls(attachment.name) : 'Attachment'}</span>
|
||||
<span className="text-muted-foreground text-xs">
|
||||
{formatFileSize(attachment.size)}
|
||||
|
||||
Reference in New Issue
Block a user