From cefa33c00df97ac704d55a14d94c58c79deea81d Mon Sep 17 00:00:00 2001 From: Masahiko AMANO Date: Thu, 11 Jun 2026 18:33:30 +0300 Subject: [PATCH] feat(frontend): focus the returned file when leaving the viewer Closing the viewer (or returning via a deep-link ?anchor=) already scrolled the grid back to the file you were on, but the keyboard roving-focus stayed unset, so the next arrow press jumped to the top. Both return paths now place the focus on that file and show the ring, so arrow navigation resumes exactly where you left off. Co-Authored-By: Claude Opus 4.8 --- frontend/src/routes/files/+page.svelte | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/routes/files/+page.svelte b/frontend/src/routes/files/+page.svelte index a408875..fd00616 100644 --- a/frontend/src/routes/files/+page.svelte +++ b/frontend/src/routes/files/+page.svelte @@ -353,6 +353,9 @@ const anchor = page.url.searchParams.get('anchor'); if (anchor) { scrollToFile(anchor); + // Pre-focus the anchor file so keyboard navigation resumes from it. + focusedId = anchor; + kbActive = true; consumeAnchor(); return; } @@ -709,6 +712,10 @@ const target = lastOverlayId; lastOverlayId = null; scrollToFile(target); + // Land the keyboard roving-focus on the file we came back from, so arrow + // navigation continues from there (and the ring marks where you were). + focusedId = target; + kbActive = true; } });