lists: don't open the drawer on UP

SmartTube keeps the focus in place when you press up on a list's first
row — the drawer popping was surprising ("why does the sidebar show up
when I go up"). The upToTopBar wiring that did it is removed everywhere;
the drawer stays reachable via LEFT at any row start, which is the other
half of the rule.
This commit is contained in:
Jeena 2026-10-13 23:37:29 +00:00
parent 64a01d8ca2
commit f0031d25c8
4 changed files with 0 additions and 16 deletions

View file

@ -217,7 +217,6 @@ fun HomeRowsScreen(
restoreToken: Int = 0, restoreToken: Int = 0,
epoch: Int = 0, epoch: Int = 0,
onOpenDrawer: () -> Unit = {}, onOpenDrawer: () -> Unit = {},
upToTopBar: (() -> Unit)? = null,
viewModel: HomeRowsViewModel = viewModel(key = "home$epoch", factory = HomeRowsViewModel.factory), viewModel: HomeRowsViewModel = viewModel(key = "home$epoch", factory = HomeRowsViewModel.factory),
) { ) {
val continueRestore = androidx.compose.runtime.remember { androidx.compose.runtime.mutableIntStateOf(-1) } val continueRestore = androidx.compose.runtime.remember { androidx.compose.runtime.mutableIntStateOf(-1) }
@ -264,7 +263,6 @@ fun HomeRowsScreen(
onLeftAtStart = onOpenDrawer, onLeftAtStart = onOpenDrawer,
clickedIndex = continueRestore, clickedIndex = continueRestore,
restoreToken = restoreToken, restoreToken = restoreToken,
upToTopBar = upToTopBar,
autoFocusOnLoad = true, autoFocusOnLoad = true,
autoFocusAllowed = { !userNavigated }, autoFocusAllowed = { !userNavigated },
) )
@ -336,7 +334,6 @@ fun FocusScrollRow(
onLeftAtStart: () -> Unit, onLeftAtStart: () -> Unit,
clickedIndex: androidx.compose.runtime.MutableIntState? = null, // set on card click clickedIndex: androidx.compose.runtime.MutableIntState? = null, // set on card click
restoreToken: Int = 0, // bumped when playback ends restoreToken: Int = 0, // bumped when playback ends
upToTopBar: (() -> Unit)? = null, // first content row only
// Only the FIRST row auto-focuses its first card when items arrive — every other // Only the FIRST row auto-focuses its first card when items arrive — every other
// row would otherwise steal focus whenever it finishes loading (#3). // row would otherwise steal focus whenever it finishes loading (#3).
autoFocusOnLoad: Boolean = false, autoFocusOnLoad: Boolean = false,
@ -403,7 +400,6 @@ fun FocusScrollRow(
compact = true, compact = true,
progress = progressOf(video.shortUUID), progress = progressOf(video.shortUUID),
onLeftAtStart = if (index == 0) onLeftAtStart else null, onLeftAtStart = if (index == 0) onLeftAtStart else null,
onUpToTopBar = upToTopBar,
onFocused = { focusedIndex = index }, onFocused = { focusedIndex = index },
) )
afterItem(index, video) afterItem(index, video)

View file

@ -174,7 +174,6 @@ fun HomeScreen(viewModel: AppViewModel = androidx.lifecycle.viewmodel.compose.vi
restoreToken = restoreToken, restoreToken = restoreToken,
epoch = epoch, epoch = epoch,
onOpenDrawer = { drawerOpen = true }, onOpenDrawer = { drawerOpen = true },
upToTopBar = { drawerOpen = true },
) )
else -> when (destination) { else -> when (destination) {
Destination.Home -> Destination.Home ->
@ -184,7 +183,6 @@ fun HomeScreen(viewModel: AppViewModel = androidx.lifecycle.viewmodel.compose.vi
epoch = epoch, epoch = epoch,
onOpenDrawer = { drawerOpen = true }, onOpenDrawer = { drawerOpen = true },
// UP over the first row opens the drawer. // UP over the first row opens the drawer.
upToTopBar = { drawerOpen = true },
) )
Destination.MyVideos -> Destination.MyVideos ->
VideoListScreen( VideoListScreen(
@ -193,7 +191,6 @@ fun HomeScreen(viewModel: AppViewModel = androidx.lifecycle.viewmodel.compose.vi
restoreToken = restoreToken, restoreToken = restoreToken,
epoch = epoch, epoch = epoch,
onOpenDrawer = { drawerOpen = true }, onOpenDrawer = { drawerOpen = true },
upToTopBar = { drawerOpen = true },
) )
Destination.Channels -> ChannelsScreen( Destination.Channels -> ChannelsScreen(
onOpenChannel = { handle -> channelDetails = handle }, onOpenChannel = { handle -> channelDetails = handle },
@ -207,7 +204,6 @@ fun HomeScreen(viewModel: AppViewModel = androidx.lifecycle.viewmodel.compose.vi
restoreToken = restoreToken, restoreToken = restoreToken,
epoch = epoch, epoch = epoch,
onOpenDrawer = { drawerOpen = true }, onOpenDrawer = { drawerOpen = true },
upToTopBar = { drawerOpen = true },
) )
Destination.Subscriptions -> Destination.Subscriptions ->
VideoListScreen( VideoListScreen(
@ -216,7 +212,6 @@ fun HomeScreen(viewModel: AppViewModel = androidx.lifecycle.viewmodel.compose.vi
restoreToken = restoreToken, restoreToken = restoreToken,
epoch = epoch, epoch = epoch,
onOpenDrawer = { drawerOpen = true }, onOpenDrawer = { drawerOpen = true },
upToTopBar = { drawerOpen = true },
) )
Destination.History -> Destination.History ->
VideoListScreen( VideoListScreen(
@ -225,7 +220,6 @@ fun HomeScreen(viewModel: AppViewModel = androidx.lifecycle.viewmodel.compose.vi
restoreToken = restoreToken, restoreToken = restoreToken,
epoch = epoch, epoch = epoch,
onOpenDrawer = { drawerOpen = true }, onOpenDrawer = { drawerOpen = true },
upToTopBar = { drawerOpen = true },
) )
} }
} }

View file

@ -60,7 +60,6 @@ fun VideoCard(
/** LEFT (only on the row's first card) can open the menu drawer. */ /** LEFT (only on the row's first card) can open the menu drawer. */
onLeftAtStart: (() -> Unit)? = null, onLeftAtStart: (() -> Unit)? = null,
/** Explicit UP-target for the first content row (focus search misses the top bar). */ /** Explicit UP-target for the first content row (focus search misses the top bar). */
onUpToTopBar: (() -> Unit)? = null,
/** Notifies the row wrapper when this card gains focus (for eased scrolling). */ /** Notifies the row wrapper when this card gains focus (for eased scrolling). */
onFocused: (() -> Unit)? = null, onFocused: (() -> Unit)? = null,
) { ) {
@ -81,9 +80,6 @@ fun VideoCard(
direction == androidx.compose.ui.input.key.Key.DirectionLeft && onLeftAtStart != null -> { direction == androidx.compose.ui.input.key.Key.DirectionLeft && onLeftAtStart != null -> {
onLeftAtStart(); true onLeftAtStart(); true
} }
direction == androidx.compose.ui.input.key.Key.DirectionUp && onUpToTopBar != null -> {
onUpToTopBar(); true
}
else -> false else -> false
} }
} else false } else false

View file

@ -51,7 +51,6 @@ fun VideoListScreen(
restoreToken: Int = 0, restoreToken: Int = 0,
epoch: Int = 0, epoch: Int = 0,
onOpenDrawer: () -> Unit = {}, onOpenDrawer: () -> Unit = {},
upToTopBar: (() -> Unit)? = null,
viewModel: VideoListViewModel = viewModel( viewModel: VideoListViewModel = viewModel(
key = "v$epoch:" + sourceKey(source), key = "v$epoch:" + sourceKey(source),
factory = VideoListViewModel.factory(source), factory = VideoListViewModel.factory(source),
@ -169,7 +168,6 @@ fun VideoListScreen(
showPrivacy = source is ListSource.MyVideos, showPrivacy = source is ListSource.MyVideos,
compact = true, compact = true,
onLeftAtStart = if (index % cardsPerRow == 0) onOpenDrawer else null, onLeftAtStart = if (index % cardsPerRow == 0) onOpenDrawer else null,
onUpToTopBar = upToTopBar?.takeIf { index < 4 },
modifier = Modifier modifier = Modifier
.focusRequester(fr), .focusRequester(fr),
) )