From 592cfd4093c8ac2553dabf073d2d7614135abc27 Mon Sep 17 00:00:00 2001 From: Michael Freno Date: Fri, 7 Aug 2026 17:46:27 -0400 Subject: [PATCH] fix search navigation --- bunfig.standalone.toml | 11 ----------- src/pages/Search/SearchPage.tsx | 26 +++++++++++++++++--------- 2 files changed, 17 insertions(+), 20 deletions(-) delete mode 100644 bunfig.standalone.toml diff --git a/bunfig.standalone.toml b/bunfig.standalone.toml deleted file mode 100644 index f1be879..0000000 --- a/bunfig.standalone.toml +++ /dev/null @@ -1,11 +0,0 @@ -# Standalone compile config for `bun build --compile` / `make dist`. -# -# This file MUST stay free of a `preload` key: Bun bakes bunfig preloads into -# compiled binaries as launch metadata, and `@opentui/solid/preload` (used for -# `bun run` dev/test) isn't embedded in the standalone, so a baked-in preload -# makes the compiled binary fail at startup with: -# error: preload not found "@opentui/solid/preload" -# -# The solid JSX transform is registered in build.ts itself (`plugin(solidPlugin)`), -# so compiling against this config needs no global preload. Invoke as: -# BUN_CONFIG=bunfig.standalone.toml bun run build.ts --compile diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 6571620..b226e60 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -60,16 +60,22 @@ function SearchPage() { // `inputFocused` is true while the query input is being typed in. The Shell // router yields keys to the while this is true; Escape (in Shell) // sets it false so navigation resumes; `s` (search action) sets it true. - // Depth transitions also drive it: typing is the default on the query depth. - let prevDepth = depth(); - onMount(() => nav.setInputFocused(true)); + // + // Typing is the default only on the query depth (0); the results depth + // (1) is always list-navigation. Drive `inputFocused` straight off + // `depth()` rather than seeding it `true` on mount and patching on change: + // the depth stack persists across tab switches, so re-mounting this page + // at depth 1 (e.g. after searching, leaving, and returning to the tab) + // must NOT leave `inputFocused` stuck on — otherwise the Shell swallows + // j/k (yielding to a non-existent input) and only the scrollbox's native + // scroll responds. + // + // The effect only re-runs on a depth transition, so Escape (defocus) and + // `s` (refocus) at the same depth are not clobbered. + onMount(() => nav.setInputFocused(depth() === 0)); onCleanup(() => nav.setInputFocused(false)); createEffect(() => { - const d = depth(); - if (d !== prevDepth) { - nav.setInputFocused(d === 0); - prevDepth = d; - } + nav.setInputFocused(depth() === 0); }); // ── results (depth 1) ───────────────────────────────────────────────────── @@ -312,7 +318,9 @@ function SearchPage() { {result.podcast.title} - + [+]