From 75b4ec37fbc00b15e3cfce25b7126fe40afbd20b Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:51:48 +0100 Subject: [PATCH] fix: say whether a conversation attachment button previews or downloads, next to the file name --- components/email/__tests__/conversation-reading.test.tsx | 2 +- components/email/thread-conversation-view.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/email/__tests__/conversation-reading.test.tsx b/components/email/__tests__/conversation-reading.test.tsx index 8d65ebe61..df3e86ca6 100644 --- a/components/email/__tests__/conversation-reading.test.tsx +++ b/components/email/__tests__/conversation-reading.test.tsx @@ -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(); }); }); diff --git a/components/email/thread-conversation-view.tsx b/components/email/thread-conversation-view.tsx index f3ed998d9..cfaed8831 100644 --- a/components/email/thread-conversation-view.tsx +++ b/components/email/thread-conversation-view.tsx @@ -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" > + {/* The action, for screen readers: the visible name alone + doesn't say whether the button previews or downloads. */} + {opensPreview ? t('files.preview') : t('email_viewer.download')}{' '} {attachment.name ? stripBidiControls(attachment.name) : 'Attachment'} {formatFileSize(attachment.size)}