Basically, I am looking for a equivalent in Jetpack Compose of the sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED)
used in xml.
Currently, my page looks in this structure:
Surface {
TopToolbarBar() {
Row() {
NavigationIcon()
Title()
....
}
}
Card1{
Row1()
Column() {
RowA()
RowB()
Button()
}
}
Card2{
...
}
}
I would like to place the accessibility focus on the Button()
instead of NavigationIcon()
when this page is open. Not sure if there is any workaround to achieve this? I don't think there is an official way to do so.
I know there is a requestFocus() method together with a FocusManager concept. However, I don't think they are useful when it comes to the accessibility focus
I tried to set a focusRequester and call requestFocus() inside a LaunchedEffect() block. But it won't work. The inital Talkback focus will stay at the navigation icon, which is the left and top most item of my Compose page.
Any hints? I also found there is a SemanticsPropertyReceiver.requestFocus
but there is barely a sample that I can use to understand how it works.