vide
10/13/2023, 11:52 AMBringIntoViewRequester.bringIntoView()
supposed to cancel the previous animation? When moving focus to an off-screen element, I first get an animation automatically triggered by FocusableNode.onFocusEvent
, and only after it has completed my own request (with a padded rect) is ran.vide
10/13/2023, 12:16 PMbringIntoView
before the FocusableNode does...vide
10/13/2023, 12:27 PMZach Klippenstein (he/him) [MOD]
10/13/2023, 1:05 PMvide
10/13/2023, 2:01 PMZach Klippenstein (he/him) [MOD]
10/13/2023, 2:03 PMZach Klippenstein (he/him) [MOD]
10/13/2023, 2:05 PMvide
10/13/2023, 2:19 PM// simplified code but you should get the general idea
fun Modifier.scrollOnFocus(...) = Modifier.onFocusChanged { if (it.hasFocus) bringIntoViewRequester.bringIntoView(paddedRect) }
@Composable fun FocusableChunk() = Box(Modifier.scrollOnFocus().focusGroup()) { content() }
FocusableChunk can be then wrap any "sections" that should usually be visible at once if even one node inside it has focus, like a TV media row but more stuff in it.
Currently it looks like onFocusChanged is called first for the parent (ActiveParent) before the activated node (Active) itself which makes timings difficult. The execution order might be unpredictable anyways as the calls are launched into coroutines.vide
10/13/2023, 4:04 PMvide
10/13/2023, 4:05 PMvide
10/25/2023, 3:41 PMvide
11/08/2023, 1:48 PMZach Klippenstein (he/him) [MOD]
11/08/2023, 3:35 PM