diff --git a/frontend/src/components/timeline/Timeline.tsx b/frontend/src/components/timeline/Timeline.tsx index 74169c4..7b09bf3 100644 --- a/frontend/src/components/timeline/Timeline.tsx +++ b/frontend/src/components/timeline/Timeline.tsx @@ -220,6 +220,17 @@ export function Timeline() { // they share one cache entry, regardless of filter state. const { data: photos = [], isLoading } = usePhotosQuery() + // Auto-focus the first photo on initial grid load so arrow-key nav + // works immediately without a pre-click. Only fires when there's no + // current active photo — we never clobber the user's selection or + // the one they restored by navigating back from preview. + useEffect(() => { + if (viewMode !== 'grid') return + if (activePhotoId) return + if (photos.length === 0) return + selectPhoto(photos[0].id) + }, [viewMode, activePhotoId, photos, selectPhoto]) + // Membership in the active heap (for the basket affordance). Subscribed // once at this level so we don't have hundreds of thumbnails each // subscribing to the same query.