'Android: Accessibility and Focusability in mixed JetpackCompose-XML Views

Required: I need to bring Focus to the top most view_the composeView, talkback to point only to it, remove other bottom view "XML layout Fragment" focus indicators ex: keyboard.

Code structure

class Fragment {

someState -> showCustomComposeDialogue()

fun showCustomComposeDialogue(){
composeErrorView.apply {
            setContent {
                MaterialTheme {
                    GeneralErrorAlertDialog(
                        onDismiss = {
                            visibilityState.value = false
                        })
                }
            }
       }

}

currently baseView has focus too, it shows keyboard and Talkback speaks both views Base-XML and Top-Compose which is confusing for talkback users.

Any possible solutions?!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source