From 2dbee503c2f01d5b217443a772e5cfbb02b8f1cd Mon Sep 17 00:00:00 2001 From: nesquena-hermes Date: Mon, 11 May 2026 04:49:18 +0000 Subject: [PATCH] feat(ux): collapse sidebar by clicking the active rail icon (fuses #1884 + #1924) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lets desktop users collapse the session-list sidebar to maximise the chat area, without adding any visible UI affordance. Default appearance is identical to master — only users who actively try to toggle (or know the keyboard shortcut) ever see a difference. ## Behaviour (desktop only, ≥641px) | State | Action | Result | |------------------------------------|-----------------------|-----------------------------------------| | Sidebar open, click active rail | Toggle | Sidebar collapses to width:0 | | Sidebar open, click different rail | Normal switch | **Sidebar stays open** (no surprise) | | Sidebar collapsed, click any rail | Expand + switch | Sidebar expands, then panel switches | | Anywhere, Cmd/Ctrl+B | Toggle | Same as same-active-rail click | | Mobile (<641px), any of the above | No-op | Mobile overlay behaviour unchanged | Two discoverability paths, both opt-in. **No new visible buttons.** Users who never click the active rail icon see zero UI change vs. master. ## Surface-minimal design The behaviour is contained behind one extra arg on the rail/sidebar-nav onclick: `switchPanel('chat',{fromRailClick:true})`. Without that flag the function preserves master's behaviour exactly — every programmatic `switchPanel(name)` callsite (commands, deeplinks, internal state changes) is unaffected. The guard chain inside `switchPanel`: opts.fromRailClick && _isDesktopWidth() && ( _isSidebarCollapsed() ? expandSidebar() : prevPanel === nextPanel ? (toggleSidebar(true); return false)) is the ONLY new code path that can cause a collapse. Cross-panel clicks fall through to the existing switch logic untouched. ## Polish from both source PRs - **Click-active gesture** as the primary toggle (#1884 @jasonjcwu — the genuine UX innovation; no extra button needed) - **Cmd/Ctrl+B keyboard shortcut** (#1924 @spektro33; VS Code convention). Guarded against firing when typing in INPUT / TEXTAREA / contenteditable so the shortcut never steals from in-progress text editing. - **Inline flash-prevention ` + @@ -86,36 +87,36 @@