Skip to content

Improve DiscoverVideoEpisodeCell focus handling#4581

Open
SergioEstevao wants to merge 3 commits into
trunkfrom
sergio/pc-tv/fix_video_cell_animation
Open

Improve DiscoverVideoEpisodeCell focus handling#4581
SergioEstevao wants to merge 3 commits into
trunkfrom
sergio/pc-tv/fix_video_cell_animation

Conversation

@SergioEstevao

@SergioEstevao SergioEstevao commented Jun 20, 2026

Copy link
Copy Markdown
Contributor
Fix PCIOS-781

Change how the focus on discover video episode cell is handled so focus conflicts are avoided when moving around quickly on the row

What changed:

  • Removed dead state left over from the old expand()/collapse()/placeholderFocusView machinery: lastFocusedButton, isContainerFocused, and isAnimating (each was declaration-only, never read or written).
  • Dropped a redundant top-level ZStack that wrapped a single VStack, and a redundant Group wrapper around the single HStack in nonFocusedContent.
  • Extracted the repeated .frame(width: isFocused ? nil : 1, height: isFocused ? nil : 1) trick into a documented collapsedWhenUnfocused(_:) view helper that explains why the 1×1 frame exists (keeping buttons in the tvOS focus chain while visually hidden).

Why: reduces noise and clarifies the intent of the focus trick so the cell is easier to maintain.

To test

  1. On the TV app, open Discover and navigate to a video episode row.
  2. Move focus onto / off a video cell — it should expand/collapse and the Play / Go to Podcast buttons should focus exactly as before.
  3. Confirm playback preview and navigation still work.

Checklist

  • I have considered if this change warrants user-facing release notes and have added them to CHANGELOG.md if necessary.
  • I have considered adding unit tests for my changes.
  • I have updated (or requested that someone edit) the Event Horizon schema to reflect any new or changed analytics.

🤖 Generated with Claude Code

SergioEstevao and others added 2 commits June 20, 2026 08:10
This avoid focus conflicts when moving quickly around cells
Follow-up cleanup to the focus refactor. Removes dead state left over
from the old expand()/collapse()/placeholderFocusView machinery
(lastFocusedButton, isContainerFocused, isAnimating), drops a redundant
top-level ZStack and a Group wrapper, and extracts the repeated
1x1-frame focus trick into a documented collapsedWhenUnfocused(_:)
helper. No behavior change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@SergioEstevao SergioEstevao added this to the Future milestone Jun 20, 2026
@SergioEstevao SergioEstevao marked this pull request as ready for review June 20, 2026 10:43
@SergioEstevao SergioEstevao requested a review from a team as a code owner June 20, 2026 10:43
@SergioEstevao SergioEstevao requested review from Copilot and kean and removed request for a team June 20, 2026 10:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors DiscoverVideoEpisodeCell (tvOS Discover video episode card) to simplify focus-handling code and reduce view-tree noise after a prior focus refactor.

Changes:

  • Removes unused focus/animation state and the old expand/collapse placeholder-focus machinery.
  • Simplifies the view hierarchy by removing redundant wrappers and always layering focused/non-focused content together.
  • Extracts the “1×1 when unfocused” focus-chain trick into a documented collapsedWhenUnfocused(_:) view helper.

Comment on lines +48 to 51
ZStack {
focusedContent
nonFocusedContent
}
collapse()
}
}
.animation(.snappy, value: isFocused)
@SergioEstevao SergioEstevao changed the title Clean up DiscoverVideoEpisodeCell focus handling Improve DiscoverVideoEpisodeCell focus handling Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants