Alexander Maryanovsky
02/28/2022, 1:56 PMModifier.focusable(false)
doesn’t work on buttons. I took the first focus example from https://github.com/JetBrains/compose-jb/tree/master/tutorials/Tab_Navigation and added a button at the bottom:
TextButton(
onClick = { println("Clicked") },
modifier = Modifier.focusable(false)
){
Text("Click me")
}
and the button still participates in focus navigation, and when it has focus and I press ENTER, it prints “Clicked”.
Is it a bug or am I misunderstanding what focusable(false)
should do?Ralston Da Silva
03/24/2022, 5:43 PMTextButton(
onClick = { println("Clicked") },
modifier = Modifier.focusProperties { canFocus = false }
){
Text("Click me")
}
Alexander Maryanovsky
03/24/2022, 6:31 PMModifier.focusProperties{ canFocus = false }
does 1Modifier.focusable(enabled: Boolean)
is very confusing.Ralston Da Silva
03/24/2022, 8:09 PMModifier.focusProperties { canFocus = false }
the item will not be focusable, and thus would not respond to any key events. Even though this is a solution for your usecase, I feel that it would be better to not use TextButton, but build your own custom component instead. It would allow you to customize the accessibility behavior of your component.