mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-04 13:03:34 -05:00
fix(ui): LB and RB on the game page move the focus ring to the tab they select (#3203)
* fix(ui): LB and RB on the game page move the focus ring to the tab they select The bumpers changed the selected tab but left focus where it was, so the ring stayed on the old tab or in the old panel. When focus is on the game page, it now moves to the newly selected tab. * fix(ui): drop a bumper's pending tab focus when another selection replaces that tab A bumper step waits a frame before focusing the tab it selected. If a tap picked a different tab in that frame, the wait still ended on the bumper's tab. The step now remembers its tab and focuses it only while that tab is still the selected one.
This commit is contained in:
1 parent
ae66be5521
commit
f0a4b084d9
1 file changed
+13
-1
@@ -226,10 +226,22 @@ internal fun GameDetail(
|
||||
val t = tab ?: return@LaunchedEffect
|
||||
if (!inPage) focusWithinFrames({ onStrip }) { tabFocus.getValue(t) }
|
||||
}
|
||||
var steppedTo by remember(key) { mutableStateOf<GameTab?>(null) }
|
||||
LaunchedEffect(steppedTo, tab) {
|
||||
val t = steppedTo ?: return@LaunchedEffect
|
||||
if (t != tab) {
|
||||
steppedTo = null
|
||||
return@LaunchedEffect
|
||||
}
|
||||
focusSoon { tabFocus.getValue(t) }
|
||||
steppedTo = null
|
||||
}
|
||||
fun cycle(step: Int) {
|
||||
if (tabs.size < 2) return
|
||||
val at = tabs.indexOf(tab).coerceAtLeast(0)
|
||||
picked = tabs[(at + step + tabs.size) % tabs.size]
|
||||
val next = tabs[(at + step + tabs.size) % tabs.size]
|
||||
picked = next
|
||||
if (inPage) steppedTo = next
|
||||
}
|
||||
val art: Any? = game?.hero ?: item?.imageUrl ?: installed?.sidecar?.hero ?: installed?.sidecar?.cover
|
||||
val artModel: Any? = if (art is String) cardArtRequest(art, item?.tallImageUrl) else art
|
||||
|
||||
Reference in new issue
Block a user