diff --git a/src/lib/components/AppLayout.svelte b/src/lib/components/AppLayout.svelte index b75ab7e..608a9cc 100644 --- a/src/lib/components/AppLayout.svelte +++ b/src/lib/components/AppLayout.svelte @@ -361,6 +361,16 @@ navFromPopstate = false; return; } + // If a modal is open, close it instead of navigating + if ($showSettings || $showInfo || $showSearch || $showCommandPalette) { + $showSettings = false; + $showInfo = false; + $showSearch = false; + $showCommandPalette = false; + // Re-push the current state so the next back still works + history.pushState({ mobileView: $mobileView, depth: historyDepth }, ''); + return; + } const state = e.state; const targetDepth = state?.depth ?? 0; historyDepth = targetDepth;