Leaving playback should return to where the viewer was in the channel list #13

Closed
opened 2026-08-26 02:00:46 +02:00 by benjamin · 1 comment
Owner

Problem

Stopping playback (Back, or the Beenden button) sets playerVisible = false and currentChannel = null, and the channel list rebuilds from scratch. Focus lands wherever Compose puts it — typically the first row or the group rail — not on the channel the viewer just watched, and not where they had navigated to in the meantime.

Failure scenario

Someone is at channel 221 far down the list, watches it, presses Back — and is dumped at the top of a 505-entry list, having to scroll all the way down again. The same happens after zapping: whatever position was reached is lost the moment playback ends.

Both list panes are affected: the scroll offset of the channel column and the selected entry in the group rail.

Suggested fix

  • Remember the last focused channel (and the rail selection) in AppState, and restore focus to that row when the list reappears
  • Scroll the list so the restored row is visible, without animating from the top
  • If the viewer zapped to a different channel during playback, return to that one — it is the position they actually left from
  • If the remembered channel is gone after a refresh, fall back to the nearest index rather than jumping to the top

Related: the group rail already resets its scroll on every group change (LaunchedEffect(groupFilter) { scrollToItem(0) }) — the restore path must not fight that.

Reported from daily use.

## Problem Stopping playback (Back, or the Beenden button) sets `playerVisible = false` and `currentChannel = null`, and the channel list rebuilds from scratch. Focus lands wherever Compose puts it — typically the first row or the group rail — not on the channel the viewer just watched, and not where they had navigated to in the meantime. ## Failure scenario Someone is at channel 221 far down the list, watches it, presses Back — and is dumped at the top of a 505-entry list, having to scroll all the way down again. The same happens after zapping: whatever position was reached is lost the moment playback ends. Both list panes are affected: the scroll offset of the channel column and the selected entry in the group rail. ## Suggested fix - Remember the last focused channel (and the rail selection) in `AppState`, and restore focus to that row when the list reappears - Scroll the list so the restored row is visible, without animating from the top - If the viewer zapped to a different channel during playback, return to *that* one — it is the position they actually left from - If the remembered channel is gone after a refresh, fall back to the nearest index rather than jumping to the top Related: the group rail already resets its scroll on every group change (`LaunchedEffect(groupFilter) { scrollToItem(0) }`) — the restore path must not fight that. Reported from daily use.
Author
Owner

Fixed in dd612fc and completed in 8068f34; shipped in v0.9.1.

  • AppState.lastWatched records the channel that was opened, so it survives the player closing.
  • LiveScreen looks that channel up in the currently shown list and, when found, scrolls to it and requests focus on that row — no animation from the top.
  • Zapping updates lastWatched too, so returning lands on the channel actually left from, not the one originally selected.
  • When the channel is gone after a refresh, the restore is skipped and the list behaves as before instead of jumping somewhere arbitrary.

Second half, found in testing: the group rail opens whatever gets focused, so when the player closed and focus landed on "Alle Sender", the view silently switched away from the group being browsed — the list then also appeared "scrolled somewhere". A restorePending flag now suppresses the rail's focus-opens-group behaviour until focus has been placed on the remembered channel, so both the group and the position come back.

Fixed in dd612fc and completed in 8068f34; shipped in v0.9.1. - `AppState.lastWatched` records the channel that was opened, so it survives the player closing. - `LiveScreen` looks that channel up in the currently shown list and, when found, scrolls to it and requests focus on that row — no animation from the top. - Zapping updates `lastWatched` too, so returning lands on the channel actually left from, not the one originally selected. - When the channel is gone after a refresh, the restore is skipped and the list behaves as before instead of jumping somewhere arbitrary. **Second half, found in testing:** the group rail opens whatever gets focused, so when the player closed and focus landed on "Alle Sender", the view silently switched away from the group being browsed — the list then also appeared "scrolled somewhere". A `restorePending` flag now suppresses the rail's focus-opens-group behaviour until focus has been placed on the remembered channel, so both the group and the position come back.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: be-nj/castarr#13