https://kotlinlang.org logo
#compose
Title
# compose
n

natario1

01/19/2022, 8:34 PM
Is it expected that a text field (BasicTextField) stops working (no keyboard, no focus) if the parent has
clickable(enabled=false, onClick=...)
? This used to work.
c

Colton Idle

01/19/2022, 8:47 PM
That makes sense to me. If you want focus while not being editable, try readOnly = true instead of enabled = false.
n

natario1

01/19/2022, 9:07 PM
The clickable modifier is applied to a parent, up in the hierarchy, unrelated to the text field. You can read this the other way: applying
clickable(enabled=false)
to a node, breaks all text fields contained in it.
c

Colton Idle

01/19/2022, 9:20 PM
oh sorry. i missed the "if the parent". I read it as "if the composable" Sorry!
z

Zach Klippenstein (he/him) [MOD]

01/19/2022, 11:11 PM
Please file a bug
n

natario1

02/03/2022, 8:54 PM
Turns out it’s considered intended behavior! https://issuetracker.google.com/issues/215403275 Compose is treating
clickable(enabled=false)
as a signal that the element is disabled (kind of like View.isEnabled), which seems weird to me. If I just disable node own clicks, it should not become a black hole for all interactions.
☝️ 1
z

Zach Klippenstein (he/him) [MOD]

02/05/2022, 4:36 PM
Huh, that's really surprising that it would even disable focus
☝️ 1
6 Views