From 0532fb2a479a199df14672f023d9b514fe56ebef Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Wed, 28 Oct 2026 11:06:18 +0100 Subject: [PATCH] fix: let senders, subjects and previews in the list and reader take their own text direction, so English text in Arabic is cut at its end --- .../email/__tests__/thread-list-item.test.tsx | 22 ++++++++++++++ components/email/email-viewer.tsx | 4 +-- components/email/thread-conversation-view.tsx | 4 +-- components/email/thread-list-item.tsx | 30 +++++++++---------- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/components/email/__tests__/thread-list-item.test.tsx b/components/email/__tests__/thread-list-item.test.tsx index 0e32699c4..ff0df5cd1 100644 --- a/components/email/__tests__/thread-list-item.test.tsx +++ b/components/email/__tests__/thread-list-item.test.tsx @@ -875,3 +875,25 @@ describe('ThreadListItem swipe on a conversation', () => { expect(onArchive).toHaveBeenCalledWith(expect.objectContaining({ id: 'b' })); }); }); + +// R11: in an Arabic interface an English subject was cut on the wrong side. +// The text takes its direction from itself, wherever it sits. +describe('ThreadListItem text direction', () => { + beforeEach(() => { + useSettingsStore.setState({ emailKeywords: [...DEFAULT_KEYWORDS], showPreview: true, mailLayout: 'split', interfaceLayout: 'default' }); + }); + + it.each([ + ['a single message', () => groupEmailsByThread([makeEmail({ preview: 'Preview text here' })])[0]], + ['a conversation', () => groupEmailsByThread([ + makeEmail({ id: 'a', receivedAt: '2024-01-15T10:00:00Z', preview: 'Preview text here' }), + makeEmail({ id: 'b', receivedAt: '2024-01-15T11:00:00Z', preview: 'Preview text here' }), + ])[0]], + ])('gives the sender, subject and preview of %s dir="auto"', (_name, makeThread) => { + render( {}} onEmailSelect={() => {}} />); + for (const text of ['Alice', 'Test Subject', 'Preview text here']) { + const el = screen.getAllByText((_c, node) => node?.textContent?.trim() === text && node.children.length === 0)[0]; + expect(el.closest('[dir="auto"]'), text).not.toBeNull(); + } + }); +}); diff --git a/components/email/email-viewer.tsx b/components/email/email-viewer.tsx index cc87d485b..d948f4d63 100644 --- a/components/email/email-viewer.tsx +++ b/components/email/email-viewer.tsx @@ -760,7 +760,7 @@ function MvConversationCard({ email, onOpen, timeFormat, compact }: { email: Ema - + {sender?.name || sender?.email || ''} @@ -876,7 +876,7 @@ export function MvExpandedConversationCard({ - {sender?.name || sender?.email || ''} + {sender?.name || sender?.email || ''} {!compact && sender?.name && sender.email && ( <{sender.email}> )} diff --git a/components/email/thread-conversation-view.tsx b/components/email/thread-conversation-view.tsx index f1baff13e..de56fab90 100644 --- a/components/email/thread-conversation-view.tsx +++ b/components/email/thread-conversation-view.tsx @@ -389,7 +389,7 @@ function EmailCard({ )}
- @@ -406,7 +406,7 @@ function EmailCard({ {formatDate(emailDisplayDate(email))}
{!isExpanded && density !== 'extra-compact' && ( -

+

{cleanPreview(email.preview) || t('email_viewer.no_preview_available')}

)} diff --git a/components/email/thread-list-item.tsx b/components/email/thread-list-item.tsx index 487d03247..a08dada20 100644 --- a/components/email/thread-list-item.tsx +++ b/components/email/thread-list-item.tsx @@ -675,7 +675,7 @@ const SingleEmailItem = React.forwardRef( {accountDescription} )} - ( {accountDescription} )} - + {sender?.name || (sender?.email && formatAddress(sender.email)) || tUnknown} @@ -707,7 +707,7 @@ const SingleEmailItem = React.forwardRef( ))} )} - @@ -715,7 +715,7 @@ const SingleEmailItem = React.forwardRef( {(previewSnippet || inlinePreview) && ( - + {/* Gmail runs the snippet on from the subject after a dash. */} {mvRow && '\u00a0-\u00a0'} {previewSnippet ? <> : (mvRow ? trimmedPreview : inlinePreview)} @@ -773,7 +773,7 @@ const SingleEmailItem = React.forwardRef( {accountDescription} )} - ( ))} )} - ( {showPreview && density !== 'extra-compact' && density !== 'compact' && (
-

{threadAccountDescription} )} - + {displayNames.join(', ')} @@ -1389,7 +1389,7 @@ export const ThreadListItem = React.forwardRef - + {displayNames.join(', ')} @@ -1397,7 +1397,7 @@ export const ThreadListItem = React.forwardRef ) : ( - )} - @@ -1430,7 +1430,7 @@ export const ThreadListItem = React.forwardRef {(previewSnippet || inlinePreview) && ( - + {mvRow && '\u00a0-\u00a0'} {previewSnippet ? <> : (mvRow ? trimmedPreview : inlinePreview)} @@ -1492,7 +1492,7 @@ export const ThreadListItem = React.forwardRef{threadAccountDescription} )} - )} - -