From acc61db6f2d8554009094913548fa82e700a9186 Mon Sep 17 00:00:00 2001 From: Shuki Vaknin Date: Tue, 23 Jun 2026 21:39:21 +0300 Subject: [PATCH] feat(settings): make return-to-list-after-action configurable (default on) Per review: gate the return-to-list behaviour behind a setting, returnToListAfterAction, defaulting to true (the Gmail/Yahoo default). When off, deleting the open message keeps the previous auto-advance-to-next behaviour. Adds the setting to the store (persisted), a toggle under Reading settings, and i18n keys across all locales (English; non-English need translation). The same setting will govern mark-as-unread (#468). --- app/(main)/[locale]/page.tsx | 10 ++++++---- components/settings/reading-settings.tsx | 8 ++++++++ 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/fr/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/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/tr/common.json | 4 ++++ locales/uk/common.json | 4 ++++ locales/zh/common.json | 4 ++++ stores/settings-store.ts | 3 +++ 22 files changed, 93 insertions(+), 4 deletions(-) diff --git a/app/(main)/[locale]/page.tsx b/app/(main)/[locale]/page.tsx index f7896154..c07514fe 100644 --- a/app/(main)/[locale]/page.tsx +++ b/app/(main)/[locale]/page.tsx @@ -3101,11 +3101,13 @@ export default function Home() { onForward={handleForward} onDelete={() => { // Deleting the open message returns to the list (Gmail-style), - // not the next email. Deselect first so the store's - // remove-and-advance sees no selection and doesn't auto-open - // the next message; then delete the captured email. + // not the next email — unless the user turned the setting off. + // Deselect first so the store's remove-and-advance sees no + // selection and doesn't auto-open the next message. const target = selectedEmail; - handleMobileBack(); + if (useSettingsStore.getState().returnToListAfterAction) { + handleMobileBack(); + } handleDelete(target); }} onArchive={() => handleArchive()} diff --git a/components/settings/reading-settings.tsx b/components/settings/reading-settings.tsx index f74aa045..1a54f8f1 100644 --- a/components/settings/reading-settings.tsx +++ b/components/settings/reading-settings.tsx @@ -22,6 +22,7 @@ export function ReadingSettings() { markAsReadDelay, deleteAction, permanentlyDeleteJunk, + returnToListAfterAction, showPreview, mailLayout, disableThreading, @@ -176,6 +177,13 @@ export function ReadingSettings() { /> + + updateSetting('returnToListAfterAction', checked)} + /> + + {!isSettingHidden('showPreview') && ( ()( firstDayOfWeek: state.firstDayOfWeek, markAsReadDelay: state.markAsReadDelay, deleteAction: state.deleteAction, + returnToListAfterAction: state.returnToListAfterAction, showPreview: state.showPreview, mailLayout: state.mailLayout, emailsPerPage: state.emailsPerPage,