In compose I have the following setup
@Composable
fun ClickableSurface(
isChecked: Boolean,
onCheckedChange: (Boolean) -> Unit,
){
Surface(
onClick = { onCheckedChange(!isChecked) },
selected = isChecked,
){
Checkbox(
checked = isChecked,
modifier = Modifier
.focusProperties { canFocus = false },
onCheckedChange = onCheckedChange
)
}
}
The surface has the same functionality as the checkbox itself so it's easier to use. When talkback is on and the user swipes between elements first the Surface will be selected (the user can double tap to activate it and the checkbox will be activated). Then after swiping again it will select the checkbox which again has the same functionality.
I don't want the checkbox to be selected and I want the system to select the next field after it which is another ClickableSurface however after putting .focusProperties { canFocus = false } doesn't work even though it is recommended in the documentation of compose
How can I make sure the checkbox CANNOT be focussed?
I have tried the following things to remove focusability:
- disabling the checkbox altogether but it still selects it in talkback
- using canFocus in FocusProperties according to documentation but it still gets focussed
- using Modifier.focusable(false) but it still gets focussed
- using clearAndSetSemantics() but again it still gets selected