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 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 18:33:30 +03:00
parent 6e5c4dc623
commit cefa33c00d
+7
View File
@@ -353,6 +353,9 @@
const anchor = page.url.searchParams.get('anchor'); const anchor = page.url.searchParams.get('anchor');
if (anchor) { if (anchor) {
scrollToFile(anchor); scrollToFile(anchor);
// Pre-focus the anchor file so keyboard navigation resumes from it.
focusedId = anchor;
kbActive = true;
consumeAnchor(); consumeAnchor();
return; return;
} }
@@ -709,6 +712,10 @@
const target = lastOverlayId; const target = lastOverlayId;
lastOverlayId = null; lastOverlayId = null;
scrollToFile(target); 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;
} }
}); });