Repository navigation
fix(tvos): focus the first On Deck item when entering from Next Up - #651
Conversation
- Let the focus engine enter the On Deck row on Down instead of redirecting the move, so the first card gets focus rather than the third. - Drop the manual Down handler and the onDeckFocusRequest counter. - Prefer default focus on the first On Deck item.
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (2)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a221ef827
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // The panel sits above the third card, so a geometric Down entry | ||
| // would skip the first. Let the focus engine enter the row and | ||
| // land on its first card instead of redirecting the move. | ||
| prefersDefaultFocusOnFirstItem: true, |
There was a problem hiding this comment.
Mount the first card before native On Deck entry
When a user moves far enough right in On Deck, presses Up to return to the action panel, and then presses Down again, the horizontal row remains parked and its LazyHStack may have unloaded the first card. MediaRow.applyFocusRequest explicitly scrolls before claiming focus because focus writes to an unloaded card are dropped; replacing that request with defaultFocus neither mounts nor scrolls to the target, so re-entry can still land on a visible later card. Reset the row to the first card, or otherwise ensure it is mounted, before relying on native entry.
AGENTS.md reference: AGENTS.md:L43-L46
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed on a tvOS 27 simulator. With 10 On Deck items I moved right to card 8, pressed Up to the Auto-play toggle, then Down. The strip stayed scrolled and focus landed on the card under the panel, not the first card. origin/main returns to the first card in the same steps.
I'm fixing it on this branch. The plan is to keep the native .defaultFocus entry and have On Deck scroll its strip back to the first card once focus has left the row, so the first card is loaded before the next Down. That avoids bringing back the programmatic redirect.
There was a problem hiding this comment.
Fixed in ab552ad. MediaRow gains scrollsToFirstItemWhenFocusLeaves: once focus has left the row, the strip scrolls back to its first card, so native entry has a loaded target. On Deck opts in, and other rows keep the default (off).
Verified on the tvOS 27 simulator with the same steps: move right 7 cards, press Up (the strip snaps back to the first card), then Down. Focus lands on the first card. The first Down into the row still lands on the first card with no flash. Captures are on the evidence page linked in the PR body.
I'm leaving this thread for its author to resolve.
|
Silo's pull request guidance changed today (#658). A PR that changes what a user sees now needs before-and-after evidence in its Evidence section, and a PR with no visible change says Missing here: A before-and-after recording of tvOS Next Up showing focus moving Down to the first On Deck card. The rules are in Show visible changes, and the PR template shows the Evidence section layout. I've converted this PR to draft for now. Mark it ready for review once the Evidence section is filled in. Generated by Claude Code |
Quick104
left a comment
There was a problem hiding this comment.
I tested this on a tvOS 27 simulator. I built origin/main and this branch, ran both against a test server with 10 On Deck items, and drove them with remote key presses.
Native entry fixes what main gets wrong on a first Down. On main, Down from the Auto-play toggle lights the third On Deck card for about one frame, then the redirect moves focus to the first card. On this branch focus lands on the first card directly. I didn't see main skip the first card outright. The visible symptom there is the brief flash.
Findings:
-
Re-entering a scrolled row lands on the wrong card (major, confirmed on the simulator). Move right through On Deck to card 8, press Up to the Auto-play toggle, then press Down. The strip stays scrolled, the first card isn't loaded, and focus lands on the card under the panel ("12 Dates of Christmas" in my run). Main returns to the first card in the same steps, because its
focusRequestpath scrolls the strip home before it claims focus. Details are in the existing thread on line 1194. I'm fixing this in a commit on this branch, so there's no need to change it yourself. -
Stale comment in
MediaRow(minor). ThefocusRequestdoc comment inMediaRow.swiftstill names PlayerView as its example caller. After this PR, PlayerView no longer passesfocusRequest. I'm updating it in the same commit. -
PR description (minor). The summary says Down "skipped the first card", and the Testing section says nothing was run. I'll rewrite both with what the simulator runs showed and add the evidence link once the fix is verified.
The cross-provider review round couldn't run (rate limited twice), so these findings come from my own review and the simulator runs.
Review by Claude Code (claude-opus-5-5).
Native entry relies on the row's first card being loaded. After the user scrolled On Deck and pressed Up, the strip stayed parked deep in its LazyHStack, so the next Down landed on the card under the panel instead of the first one. MediaRow gains scrollsToFirstItemWhenFocusLeaves, which scrolls the strip home once focus has left the row. On Deck opts in. Also drop the stale PlayerView example from the focusRequest doc comment. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Review summaryReviewed head: ab552ad (the PR's commit 2a221ef plus one fix commit from this review) What the PR fixes. On main, Down from the Auto-play toggle into On Deck focuses the third card for about one frame before the redirect moves focus to the first card. This branch lets the focus engine enter the row on its first card, so the flash is gone. I didn't see main skip the first card outright, so the PR body now describes the flash. Addressed in this review
Remaining
Validated features: not checked. The v1.0 board couldn't be read during this review. The change only touches tvOS Next Up focus. User manual: unaffected. The site describes the next-up screen but not its focus behavior. Apple/Android parity: Android TV's Next Up panel also sits above On Deck cards 3–5, and its row uses plain geometric entry, so a Down from the panel probably lands on card 3 there. I haven't run it. I recommend a parity issue in silo-android to check and match first-card entry. Cross-provider review: a Codex round was attempted twice and hit rate limits both times. It didn't run. Fit: 7/10 · Readiness: 7/10 — conditional
Review by Claude Code (claude-opus-5-5). |
| /// pull the strip out from under the user. | ||
| private func scrollToFirstItemIfUnfocused(proxy: ScrollViewProxy) { | ||
| DispatchQueue.main.async { | ||
| guard focusedItemId == nil, let firstItem = items.first else { return } |
There was a problem hiding this comment.
Validate the captured generation and selection identity after the suspension before scrolling; otherwise a callback queued for a disappearing card can run after a context-menu restoration or membership refresh and act on stale focus state.
Also found in:
iosApp/iosApp/Components/MediaRow.swift:176-176
Kody rule violation: Bind delayed presentation work to selection identity and current content
guard generation == focusRestorationGeneration,
focusedItemId == nil,
lastFocusedItemId == departedItemId,
let firstItem = items.first else { return }Prompt for LLM
File iosApp/iosApp/Components/MediaRow.swift:
Line 177:
Validate the captured generation and selection identity after the suspension before scrolling; otherwise a callback queued for a disappearing card can run after a context-menu restoration or membership refresh and act on stale focus state.
**Also found in:**
- `iosApp/iosApp/Components/MediaRow.swift:176-176`
Suggested Code:
guard generation == focusRestorationGeneration,
focusedItemId == nil,
lastFocusedItemId == departedItemId,
let firstItem = items.first else { return }
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
The scroll-home-on-focus-leave handler from #651 read the row's @focusstate in an onChange attached directly to the strip. That made the strip's body depend on focus, so every move between cards re-evaluated the LazyHStack and every card in it, which is what TVRowFocusObserver exists to prevent. The handler now lives in a TVRowFocusLeaveObserver modifier that takes the binding, attached only to rows that set scrollsToFirstItemWhenFocusLeaves. The strip still scrolls back to its first card once focus leaves the row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
#651 removed focusFirstOnDeckItem() and let the focus engine enter On Deck on Down, but the Stop Shuffling button on the Next Up screen still called it, so SiloTV no longer compiled. Down from that button is now left to the focus engine too, which enters On Deck at its first card the same way it does from the actions row. Closes #753 Co-authored-by: Claude Opus 5.5 <[email protected]>
#651 removed focusFirstOnDeckItem() and let the focus engine enter On Deck on Down, but the Stop Shuffling button on the Next Up screen still called it, so SiloTV no longer compiled. Down from that button is now left to the focus engine too, which enters On Deck at its first card the same way it does from the actions row. Closes #753 Co-authored-by: Claude Opus 5.5 <[email protected]> (cherry picked from commit c49b1cf)
Problem
Related issue: N/A
Validation tasks: not checked yet (the v1.0 board couldn't be read during review)
On the tvOS Next Up screen the action panel sits above the third On Deck card. Pressing Down from the Auto-play toggle into On Deck briefly focused that third card. The screen's redirect then moved focus to the first card, so the move showed as a one-frame flash on the wrong card.
Approach
prefersDefaultFocusOnFirstItem, so the focus engine enters the row on its first card. The programmatic redirect is gone:onDeckFocusRequest,focusFirstOnDeckItem(), and the Down branch on the Auto-play toggle. This keeps the screen on the native focus graph, asdocs/tvos-focus.mdasks.MediaRowgainsscrollsToFirstItemWhenFocusLeaves, which scrolls the strip back to its first card once focus has left the row. On Deck opts in, and other rows are unchanged.focusBelowActions()now only handles the Auto-play toggle. Without the toggle, Down enters On Deck natively.Validation
Evidence
Evidence: https://evidence.siloserver.org/r/silo-apple/pr-651/
Surface and build: tvOS Next Up screen, SiloTV Debug on a tvOS 27 simulator.
Risks
scrollsToFirstItemWhenFocusLeavesdefaults to off, so rows other than On Deck behave as before. With it on, the strip waits one turn after focus reads nil, so a card-to-card move or a context-menu dismissal doesn't scroll it.Checklist
AI Disclosure
Note
Focus first On Deck item when entering Next Up screen on tvOS
Replaces the screen-local focus-request counter in
PlayerNextUpScreenwithMediaRowconfiguration. The On Deck row now declares its first item as the default focus target and scrolls back to it when focus leaves the row.scrollToFirstItemIfUnfocusedin MediaRow.swift. It defers one main-queue turn, then scrolls to the first item only if focus is still absent.focusFirstOnDeckItem, the on-deck focus request state, and the Down-move interception from the auto-play control handler in PlayerView.swift.focusBelowActionsno longer focuses the first On Deck item; it leaves focus unchanged. Pressing Down on the Auto-play control is no longer intercepted to force On Deck focus.Macroscope summarized ab552ad.