I'm having trouble getting focus on one of my comp...
# compose
c
I'm having trouble getting focus on one of my components. This is my code:
Copy code
val focusRequester = FocusRequester()

Column {
    Box(Modifier.weight(1f).padding(5.dp)
        .focusable()
        .focusRequester(focusRequester)
        .onFocusChanged {
            println(it.isFocused)
            focusRequester.requestFocus()
        }) {
        // draw stuff here
    }
}
... but it just prints
false
once and never prints anything else, even when I click around to textfields and buttons which aren't contained within my component.
a
Move
focusRequester
and
onFocusChanged
before
focusable
.
c
That's ... unexpected.
It feels weird marking the box as focusable after you provide the
focusRequester
and register for events.
a
What a modifier modifies is its child, which is the composable it's applied to and all the modifiers after it.