Email/doc split: stop auto-tab-down when there's no room

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.
This commit is contained in:
pewdiepie-archdaemon
2026-06-11 07:17:26 +09:00
parent 2bf372b41c
commit 9dbe31bfb0
+7 -7
View File
@@ -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')) {