Is there some documentation about Compose DPAD nav...
# compose-android
t
Is there some documentation about Compose DPAD navigation and decision making and ways to control this ?
I'm trying to provide a build of my app that more or less works on Android TV. Most things works well, but I'm having a problem with reaching a part of the app.
In that screen when the selected element is Album artists and I press up it goes to the left navigation rail, when I'd like it to go to the top right button bar that is actually part of the same screen.
If I first move to Genres then up it will go there, so it seems it decide based on the relative position of items and not the hierarchy.
j
I think Focus API’s are what you need. Take a look here.
t
Thanks, yes this leads me to https://developer.android.com/develop/ui/compose/touch-input/focus/change-focus-traversal-order that should do it. Will need to think about how to pass those all over the hierarchy.
a
Maybe it is just me, but this behavior seems to be the logical one for me as an app user, since Compose tries to find the nearest visible focusable Composable to select in the requested direction.
t
You justify that it's logical due to how Compose works, now how as an user you'd expect it to work. That screen may not be the best example but the filter buttons purpose is to filter the current screen and the nav bar is to change screen. If if the focus is inside the screen, I expect up to move inside the screen to always reach the filter button and not randomly the filter button or something outside the screen. Even worse if there's 5 items in the row for example, when in the middle you can't guess where it will go.
a
Ok that makes sense to me, thank you for the explanation.