From 273d0c79858ed7f1f44e6e26094222cbbbcd98df Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Sun, 7 Jun 2026 09:58:46 +0200 Subject: [PATCH] fix(back): don't short-circuit side-nav back chain to home The side-nav host's onSystemBack called _handleMainBack on the system route-pop path, jumping straight to the home tab and skipping the dpad back chain (content -> top tabs -> sidebar). Restore the original inert behavior: canPop:false blocks the route-pop and the key path owns the chain; the host still closes an open sheet on back. Bottom-nav unchanged. --- lib/screens/main_screen.dart | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/lib/screens/main_screen.dart b/lib/screens/main_screen.dart index 2112ba1e..318f7e2f 100644 --- a/lib/screens/main_screen.dart +++ b/lib/screens/main_screen.dart @@ -1588,18 +1588,12 @@ class _MainScreenState extends State return OverlaySheetHost( onOpenChanged: _handleOverlaySheetOpenChanged, - // The host owns sheet + system back. canPop:false because the dpad - // back is handled by the key path below; onSystemBack mirrors it for - // a pure popRoute (focus sidebar first, otherwise home/exit). + // canPop:false blocks the system route-pop (matching the old inert + // PopScope). The dpad/key back chain (content → top tabs → sidebar → + // home) is owned entirely by the key path below; there is NO + // onSystemBack because a pure popRoute must not short-circuit that + // chain to home. The host still closes an open sheet on system back. canPop: false, - onSystemBack: () { - if (BackKeyCoordinator.consumeIfHandled()) return; - if (!_isSidebarFocused) { - _focusSidebar(); - return; - } - _handleMainBack(); - }, child: Focus( onKeyEvent: (node, event) { final fullscreenResult = _handleFullscreenShortcut(event);