https://kotlinlang.org logo
Title
k

Karlo Lozovina

10/27/2021, 9:38 PM
How can I capture key events happening on a
ClickableText
? I've tried with
Modifier.onPreviewKeyEvent
but nothing seems to be happening...
I have a single widget on the screen, and it (ClickableText) starts registering key events if I press a Tab key before... I guess it's not getting the focus somewhow?
I've tried with a FocusRequester(), then in the onClick handler calling focusRequester.requestFous(), but nothing's happening..
Huh, it seems I have to call .focusRequster() Modifier before calling .focusable(), otherwise it doesn't work, weird
s

Sean Proctor

10/28/2021, 11:30 AM
Also, make sure to
remember
your
FocusRequester()
(It's easy to forget and a source of weird bugs)
👍 1