From d278bd5a7793bdba2588fe3df892f7009255202b Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Wed, 4 Nov 2026 14:59:26 +0100 Subject: [PATCH 1/2] fix: show the preview on its own line again at the regular density --- .../__tests__/list-row-preview-lines.test.tsx | 46 +++++++------------ .../thread-list-item-columns.test.tsx | 4 +- components/email/email-list.tsx | 10 ++-- components/email/thread-list-item.tsx | 22 ++------- hooks/use-list-row-shape.ts | 16 ------- 5 files changed, 25 insertions(+), 73 deletions(-) diff --git a/components/email/__tests__/list-row-preview-lines.test.tsx b/components/email/__tests__/list-row-preview-lines.test.tsx index 366ab7709..a32f33131 100644 --- a/components/email/__tests__/list-row-preview-lines.test.tsx +++ b/components/email/__tests__/list-row-preview-lines.test.tsx @@ -54,38 +54,24 @@ beforeEach(() => { useEmailStore.setState({ selectedEmailKeys: new Set(), selectedMailbox: 'inbox' }); }); -// mail-15: the default density puts the preview after the subject, on the -// subject's line, so about ten rows fit at 1366×768 (they were about 96 px, -// seven on screen); comfortable keeps two preview lines, and a phone keeps -// the preview under the subject. +// mail-15: the default density shows one preview line, so more rows fit; +// comfortable keeps two. describe('list row preview lines', () => { - const onSubjectLine = () => { - const preview = screen.getByText(PREVIEW, { exact: false }); - return preview.closest('[data-row-preview]') !== null; - }; + it.each([ + ['regular', 'line-clamp-1'], + ['comfortable', 'line-clamp-2'], + ] as const)('a %s row clamps its preview with %s', (density, clamp) => { + useSettingsStore.setState({ density }); + renderRow([makeEmail()]); + expect(screen.getByText(PREVIEW).className.split(/\s+/)).toContain(clamp); + }); it.each([ - ['message', [makeEmail()]], - ['conversation', [makeEmail({ id: 'a' }), makeEmail({ id: 'b', receivedAt: '2024-01-16T10:00:00Z' })]], - ] as const)('a regular %s row shows its preview on the subject line', (_kind, emails) => { - useSettingsStore.setState({ density: 'regular' }); - renderRow([...emails]); - expect(onSubjectLine()).toBe(true); - expect(document.querySelector('p.line-clamp-1')).toBeNull(); - }); - - it('a comfortable row keeps two preview lines of its own', () => { - useSettingsStore.setState({ density: 'comfortable' }); - renderRow([makeEmail()]); - expect(onSubjectLine()).toBe(false); - expect(screen.getByText(PREVIEW).className.split(/\s+/)).toContain('line-clamp-2'); - }); - - it('a regular row on a phone keeps the preview under the subject', () => { - useUIStore.setState({ isMobile: true }); - useSettingsStore.setState({ density: 'regular' }); - renderRow([makeEmail()]); - expect(onSubjectLine()).toBe(false); - expect(screen.getByText(PREVIEW).className.split(/\s+/)).toContain('line-clamp-1'); + ['regular', 'line-clamp-1'], + ['comfortable', 'line-clamp-2'], + ] as const)('a %s conversation row clamps its preview with %s', (density, clamp) => { + useSettingsStore.setState({ density }); + renderRow([makeEmail({ id: 'a' }), makeEmail({ id: 'b', receivedAt: '2024-01-16T10:00:00Z' })]); + expect(screen.getByText(PREVIEW).className.split(/\s+/)).toContain(clamp); }); }); diff --git a/components/email/__tests__/thread-list-item-columns.test.tsx b/components/email/__tests__/thread-list-item-columns.test.tsx index ed27738ce..98c275ee0 100644 --- a/components/email/__tests__/thread-list-item-columns.test.tsx +++ b/components/email/__tests__/thread-list-item-columns.test.tsx @@ -93,9 +93,7 @@ describe('message list rows under the bottom reading pane (#262)', () => { it('keeps stacked rows in the split layout', () => { useSettingsStore.setState({ mailLayout: 'split' }); const { container } = renderEmails([makeEmail()]); - // Stacked: a preview line of its own, or the preview after the subject - // on the subject's line at the regular density (mail-15). - expect(container.querySelector('p, [data-row-preview]')).not.toBeNull(); + expect(container.querySelector('p')).not.toBeNull(); }); describe('as columns', () => { diff --git a/components/email/email-list.tsx b/components/email/email-list.tsx index ec02b40c5..4d0b0c496 100644 --- a/components/email/email-list.tsx +++ b/components/email/email-list.tsx @@ -39,7 +39,7 @@ import { useOpenEmailInWindow } from "@/hooks/use-popouts-available"; import { useIsDesktop } from "@/hooks/use-media-query"; import { useIsEmbedded } from "@/hooks/use-is-embedded"; import { useSettingsStore } from "@/stores/settings-store"; -import { useListRowShape, showsPreviewOnSubjectLine } from "@/hooks/use-list-row-shape"; +import { useListRowShape } from "@/hooks/use-list-row-shape"; import { MailListRowsSkeleton, type MailRowShape } from "@/components/boot-skeleton/mail-skeleton"; import type { Density } from "@/lib/density"; import { useUIStore } from "@/stores/ui-store"; @@ -492,11 +492,7 @@ export function EmailList({ // up after a jump down (scrollbar drag, End). So guess per row. const latest = item?.kind === 'row' ? item.thread.latestEmail : undefined; let size = { 'extra-compact': 32, compact: 60, regular: 84, comfortable: 104 }[density]; - if (showsPreviewOnSubjectLine({ showPreview, density, isMobile, mountainView: mountainViewList })) { - // The preview follows the subject on its line, and the subject line - // drops its margin (mail-15). - size -= 4; - } else if (showPreview && density !== 'extra-compact') { + if (showPreview && density !== 'extra-compact') { // A mail without a preview draws a one-line "No preview available", // a line (23px) shorter than a real one. Only comfortable rows show a // second preview line (mail-15). @@ -507,7 +503,7 @@ export function EmailList({ const hasCode = !!latest && showVerificationCodes && !!listVerificationCode(latest); if (latest && (hasCode || (onOpenAttachment && listRowShowsChips(latest, loadAttachments)))) size += 28; return size; - }, [density, isFocusedMailLayout, showPreview, showVerificationCodes, items, onOpenAttachment, loadAttachments, isMobile, mountainViewList]); + }, [density, isFocusedMailLayout, showPreview, showVerificationCodes, items, onOpenAttachment, loadAttachments]); // Stable per list, so the virtualizer does not rebuild every row's // measurement on each scroll render. diff --git a/components/email/thread-list-item.tsx b/components/email/thread-list-item.tsx index 4df3e97dc..2c04cbfed 100644 --- a/components/email/thread-list-item.tsx +++ b/components/email/thread-list-item.tsx @@ -17,7 +17,7 @@ import { Paperclip, Star, Pin, Circle, ChevronRight, ChevronDown, Loader2, Messa import type { AppIcon } from "@/components/icons"; import { useSettingsStore, KEYWORD_PALETTE } from "@/stores/settings-store"; import { useShallow } from "zustand/react/shallow"; -import { useListRowShape, LIST_COLUMN_CLASS, showsPreviewOnSubjectLine } from "@/hooks/use-list-row-shape"; +import { useListRowShape, LIST_COLUMN_CLASS } from "@/hooks/use-list-row-shape"; import { SizeCell } from "./list-columns"; import { accountTintKey, generateAvatarColor } from "@/lib/account-utils"; import { useUIStore } from "@/stores/ui-store"; @@ -499,7 +499,6 @@ const SingleEmailItem = React.forwardRef( // together. const mvRow = interfaceLayout === 'mountain-view' && oneLineRow; const mvMobileRow = interfaceLayout === 'mountain-view' && isMobile; - const previewOnSubjectLine = showsPreviewOnSubjectLine({ showPreview, density, isMobile, mountainView: interfaceLayout === 'mountain-view' }); const trimmedPreview = cleanPreview(email.preview); const inlinePreview = showPreview && trimmedPreview ? ` ${trimmedPreview}` : ''; // Search hits carry server snippets with the matched terms marked; they @@ -973,7 +972,7 @@ const SingleEmailItem = React.forwardRef( -
+
{tagPlacement === 'subject' && tagIds.length > 0 && ( {tagIds.map((id) => ( @@ -988,16 +987,11 @@ const SingleEmailItem = React.forwardRef( : "font-normal text-foreground/90" )}> {subjectSnippet ? : (email.subject || tNoSubject)} - {previewOnSubjectLine && ( - - {' – '}{previewSnippet ? : (trimmedPreview || t('no_preview_available'))} - - )}
- {showPreview && !previewOnSubjectLine && density !== 'extra-compact' && density !== 'compact' && ( + {showPreview && density !== 'extra-compact' && density !== 'compact' && (

-
+
{tagPlacement === 'subject' && tagIds.length > 0 && ( {tagIds.map((id) => ( @@ -1782,16 +1775,11 @@ export const ThreadListItem = React.forwardRef {subjectSnippet ? : (latestEmail.subject || tNoSubject)} - {previewOnSubjectLine && ( - - {' – '}{previewSnippet ? : (trimmedPreview || tEmailViewer('no_preview_available'))} - - )}
- {showPreview && !previewOnSubjectLine && density !== 'extra-compact' && density !== 'compact' && ( + {showPreview && density !== 'extra-compact' && density !== 'compact' && (

Date: Wed, 4 Nov 2026 15:19:11 +0100 Subject: [PATCH 2/2] feat: add a setting to keep the account switcher at the top of the sidebar, on by default --- app/boot-skeleton.css | 3 ++ components/boot-skeleton/mail-skeleton.tsx | 12 +++--- components/email/email-list.tsx | 10 +++-- .../layout/__tests__/sidebar-compose.test.tsx | 39 ++++++++++++++++--- components/layout/sidebar.tsx | 20 ++++++---- .../mail/__tests__/after-send-hook.test.tsx | 13 +++++-- .../mail/__tests__/mobile-tour-end.test.tsx | 26 +++++++++---- components/mail/mail-app.tsx | 9 +++-- components/settings/layout-settings.tsx | 13 +++++-- .../__tests__/boot-script.test.ts | 11 ++++++ lib/boot-skeleton/boot-script.ts | 3 ++ lib/plugin-sandbox/host-api-app.ts | 2 +- lib/settings-schema.ts | 1 + lib/settings-search.ts | 1 + locales/ar/common.json | 4 ++ locales/ca/common.json | 4 ++ locales/cs/common.json | 4 ++ locales/da/common.json | 4 ++ locales/de/common.json | 4 ++ locales/en/common.json | 4 ++ locales/es/common.json | 4 ++ locales/et/common.json | 4 ++ locales/fa/common.json | 4 ++ locales/fr/common.json | 4 ++ locales/he/common.json | 4 ++ locales/hu/common.json | 4 ++ locales/it/common.json | 4 ++ locales/ja/common.json | 4 ++ locales/ko/common.json | 4 ++ locales/lv/common.json | 4 ++ locales/mn/common.json | 4 ++ locales/nb/common.json | 4 ++ locales/nl/common.json | 4 ++ locales/pl/common.json | 4 ++ locales/pt/common.json | 4 ++ locales/ro/common.json | 4 ++ locales/ru/common.json | 4 ++ locales/sk/common.json | 4 ++ locales/th/common.json | 4 ++ locales/tr/common.json | 4 ++ locales/uk/common.json | 4 ++ locales/vi/common.json | 4 ++ locales/zh-TW/common.json | 4 ++ locales/zh/common.json | 4 ++ stores/settings-store.ts | 5 +++ 45 files changed, 247 insertions(+), 41 deletions(-) diff --git a/app/boot-skeleton.css b/app/boot-skeleton.css index dbf7543cf..dc27f65a3 100644 --- a/app/boot-skeleton.css +++ b/app/boot-skeleton.css @@ -30,6 +30,9 @@ } } +/* Compose heads the folder sidebar, in place of the account switcher. */ +@custom-variant boot-sidebar-compose (&:where([data-boot-sidebar-compose="on"] *)); + /* A message, thread, contact, settings page or admin page is open. */ @custom-variant boot-open (&:where([data-boot-pane] *)); @custom-variant boot-thread (&:where([data-boot-pane="thread"] *)); diff --git a/components/boot-skeleton/mail-skeleton.tsx b/components/boot-skeleton/mail-skeleton.tsx index 07c634645..2a3b4a87d 100644 --- a/components/boot-skeleton/mail-skeleton.tsx +++ b/components/boot-skeleton/mail-skeleton.tsx @@ -131,7 +131,7 @@ function SidebarSkeleton({ embedded }: { embedded: boolean }) { {/* A compact desktop folds the sidebar to its icons (sidebarFolded). */} - + @@ -139,9 +139,11 @@ function SidebarSkeleton({ embedded }: { embedded: boolean }) { + {/* Compose in place of the account switcher (sidebarAccountSwitcher off). */} +

- {/* The folded sidebar's Compose button. */} -
+ {/* The folded sidebar's Compose button (sidebarAccountSwitcher off). */} +
@@ -665,8 +667,8 @@ export function MailSkeletonBody({ embedded = false }: { embedded?: boolean }) { className={cn( "absolute z-40 shadow-lg bottom-4 end-4 h-12 w-12 max-desk:h-14 max-desk:w-14", "max-desk:mv:w-36 max-desk:mv:rounded-2xl", - // A desktop has Compose in the folder sidebar; a Pro pane keeps the round one. - !embedded && "desk:hidden", + // A desktop can have Compose in the folder sidebar instead; a Pro pane keeps the round one. + !embedded && "desk:mv:hidden desk:boot-sidebar-compose:hidden", )} />
diff --git a/components/email/email-list.tsx b/components/email/email-list.tsx index 4d0b0c496..aa32bf841 100644 --- a/components/email/email-list.tsx +++ b/components/email/email-list.tsx @@ -216,6 +216,7 @@ export function EmailList({ const mountainViewList = useSettingsStore((state) => state.interfaceLayout === 'mountain-view'); const isDesktopPane = useIsDesktop(); const isEmbeddedList = useIsEmbedded(); + const sidebarAccountSwitcher = useSettingsStore((state) => state.sidebarAccountSwitcher); const undo = undoLabels(tNotifications); const tRemove = useTranslations('email_list.confirm_remove'); const { client } = useAuthStore(useShallow((state) => ({ client: state.client }))); @@ -1161,10 +1162,11 @@ export function EmailList({ // Room under the last row for the round Compose button, which would otherwise // sit on that row's actions (Mountain View has no such button, and a desktop - // has Compose in the folder sidebar instead). A spacer and - // not padding on the list: padding is a minimum height the list can't go - // under, and on a short screen it pushed the rows over the tab bar. - const composeButtonRoom = !mountainViewList && (!isDesktopPane || isEmbeddedList) ? - {/* Floating Compose Button - on desktop the folder sidebar has - Compose at its top instead (and Mountain View its rail), so the - button no longer sits on the list's rows. */} - {!mvShell && (isMobile || isEmbedded) &&