So I’m working on an accessibility feature.
My task is to announce an error message, which appears right after I click the submit button.
Other than that, the error message can not get a focus, so the focus stays on the button while the talkback reads the error message.
I’m not sure if it is possible.
@Composable
fun Feature(modifier: Modifier = Modifier) {
var isError = false
if (isError) {
Column {
Text(text = "Error message to be announced")
}
}
Button(modifier = Modifier.semantics {
contentDescription = "Submit button "
},
onClick = { isError = true }) {
Text(text = "Submit")
}
}```
It is a very simple example, how the UI looks like now.