fix search navigation
This commit is contained in:
@@ -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
|
|
||||||
@@ -60,16 +60,22 @@ function SearchPage() {
|
|||||||
// `inputFocused` is true while the query input is being typed in. The Shell
|
// `inputFocused` is true while the query input is being typed in. The Shell
|
||||||
// router yields keys to the <input> while this is true; Escape (in Shell)
|
// router yields keys to the <input> while this is true; Escape (in Shell)
|
||||||
// sets it false so navigation resumes; `s` (search action) sets it true.
|
// 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();
|
// Typing is the default only on the query depth (0); the results depth
|
||||||
onMount(() => nav.setInputFocused(true));
|
// (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));
|
onCleanup(() => nav.setInputFocused(false));
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
const d = depth();
|
nav.setInputFocused(depth() === 0);
|
||||||
if (d !== prevDepth) {
|
|
||||||
nav.setInputFocused(d === 0);
|
|
||||||
prevDepth = d;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── results (depth 1) ─────────────────────────────────────────────────────
|
// ── results (depth 1) ─────────────────────────────────────────────────────
|
||||||
@@ -312,7 +318,9 @@ function SearchPage() {
|
|||||||
{result.podcast.title}
|
{result.podcast.title}
|
||||||
</text>
|
</text>
|
||||||
<Show when={result.podcast.isSubscribed}>
|
<Show when={result.podcast.isSubscribed}>
|
||||||
<text fg={index() === fi() ? theme.surface : theme.success}>
|
<text
|
||||||
|
fg={index() === fi() ? theme.surface : theme.success}
|
||||||
|
>
|
||||||
[+]
|
[+]
|
||||||
</text>
|
</text>
|
||||||
</Show>
|
</Show>
|
||||||
|
|||||||
Reference in New Issue
Block a user