Alex Styl
04/16/2025, 10:15 AMonFocusChanged {}
to the box and press tab to focus targets inside of a box, then the Box's onFocusChanged{} reports hasFocused = false
for a split second.Louis Pullen-Freilich [G]
04/16/2025, 10:50 AMAlex Styl
04/16/2025, 10:57 AMLouis Pullen-Freilich [G]
04/16/2025, 11:00 AMLouis Pullen-Freilich [G]
04/16/2025, 11:02 AMAlex Styl
04/16/2025, 11:02 AMLouis Pullen-Freilich [G]
04/16/2025, 11:03 AMhasFocused = false
shows up for a small period of timeLouis Pullen-Freilich [G]
04/16/2025, 11:04 AMAlex Styl
04/16/2025, 11:33 AMRow(Modifier.fillMaxWidth().onFocusChanged { println("Group has focus ${it.hasFocus}") }) {
Box(Modifier.clickable { }) {
Text("Button 1")
}
Box(Modifier.clickable { }) {
Text("Button 1")
}
}
Louis Pullen-Freilich [G]
04/16/2025, 11:46 AMLouis Pullen-Freilich [G]
04/16/2025, 11:48 AMfocusGroup()
modifier to the parent RowLouis Pullen-Freilich [G]
04/16/2025, 11:49 AMRow(Modifier.fillMaxWidth().onFocusChanged {
println("Group has focus ${it.hasFocus}")
}.focusGroup()) {
Box(Modifier.clickable { }) {
Text("Button 1")
}
Box(Modifier.clickable { }) {
Text("Button 1")
}
}
This won’t print false, because the group never loses focus when moving between childrenAlex Styl
04/16/2025, 11:55 AMAlex Styl
04/16/2025, 11:55 AMLouis Pullen-Freilich [G]
04/16/2025, 11:55 AM