I'm having a problem with keyboard events and focu...
# compose
c
I'm having a problem with keyboard events and focus in my multiplatform app. Up to this point I've just had a single custom component in the middle of the screen. I've dealt with keyboard events by registering a global
onPreviewKeyEvent
. Only now I need to put some textfields around that component, so capturing keyboard events globally doesn't work. I think what I need to do is make my component focusable, and get keyboard events. But it's not working.
I've made the component
focusable
, and I've verified I can programmatically request and gain focus. But it doesn't automatically get focus when I click on it. I'm not sure if I'm expected to add a click handler and request focus every time someone clicks on it, or if there's something else I need to do to enable the system.