From 9dbe31bfb07c5eb4cb0664866fe288bf8aa3245d Mon Sep 17 00:00:00 2001 From: pewdiepie-archdaemon Date: Thu, 11 Jun 2026 07:17:26 +0900 Subject: [PATCH] Email/doc split: stop auto-tab-down when there's no room MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously _prepareEmailWindowForDocument would: 1. Check if there was horizontal room for both email + doc. 2. If not, try collapsing the sidebar to recover space. 3. If even that wasn't enough, _clearEmailDocumentSplit() — the email tab-down the user has been disliking. Drop step 3. We still try collapsing the sidebar (free easy room), but if the layout is still cramped, just dock anyway and let the user manage their layout. _clearEmailDocumentSplit() is still called on the legitimate close paths. --- static/js/emailLibrary.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/static/js/emailLibrary.js b/static/js/emailLibrary.js index 3747db411..e69f22680 100644 --- a/static/js/emailLibrary.js +++ b/static/js/emailLibrary.js @@ -436,18 +436,18 @@ function _hasDesktopRoomForEmailAndDocument(modal, opts = {}) { function _prepareEmailWindowForDocument(modal) { if (window.innerWidth <= 768) return true; if (!modal) return false; + // Try to make breathing room by collapsing the wide sidebar to the rail + // when there isn't enough horizontal space for both panes. The + // route-collapse marker that collapseSidebarToRail() sets means the + // sidebar will auto-restore when the doc closes. Crucially, we no + // longer fall back to clearing the split when even that isn't enough — + // the user opted out of auto-tab-down, so we proceed with the dock + // even if it's cramped. if (!_hasDesktopRoomForEmailAndDocument(modal)) { - // Before giving up and minimizing email, see if collapsing the wide - // sidebar to the rail would recover enough space. The route-collapse - // marker that collapseSidebarToRail() sets makes the existing - // auto-restore logic put the sidebar back when the doc closes. const sidebar = document.getElementById('sidebar'); const sidebarWasOpen = sidebar && !sidebar.classList.contains('hidden'); if (sidebarWasOpen && _hasDesktopRoomForEmailAndDocument(modal, { assumeSidebarCollapsed: true })) { try { collapseSidebarToRail(); } catch (_) {} - } else { - _clearEmailDocumentSplit(); - return true; } } if (modal.classList.contains('modal-left-docked')) {