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')) {