I'm sure this is just a noob issue, but I cannot, ...
# compose
r
I'm sure this is just a noob issue, but I cannot, for the life of me, figure out how to get hardware keys like tab and enter to correspond to shifts in focus for compose 😕 I will paste my simple composable in the thread, really hope that someone can point me in the right direction
1
Untitled.kt
s
Might not help here, I’ve never had to do this myself, but I’d start by at least making your text field use
singleLine = true
as a parameter, to at least not start a new line on enter press. If this alone doesn’t help I’m also out of ideas, just thought I’d share this idea 😄
r
🙂 thanks, that doesn't fix the problem, but it is worth adding, since you would not want to allow multi line usernames and logins
s
Ah unfortunate! Hope you find your solution still 🤞
🙏 1
a
@Ryan Brink out of curiosity, how are you triggering the 'tab' and 'enter' hardware keys on the android?
r
just by typing it on my physical keyboard, but, I am also building this as a multiplatform project, so, same goes for desktop (and eventually wasm), which is why this is important
j
Here's some resources on focus for Android and Desktop.
p
I think tab won't work for you on a mobile device. Keyboard usually has "next" option, to move focus to next item. I think tab focus switch is only a thing on desktop
Maybe compose for desktop behaves differently in that regard?
r
interesting... yes ok, it seems like the behavior is mostly there on desktop (only thing missing is "enter" acting as a login action) but that is not the end of the world. So i guess these just operate differently on android vs desktop. Good to know, thanks for the assist! I'm curious what this means for tablets, potentially with a bluetooth keyboard attached 🤔
k
I recall this is a bug because in xml you are able to achieve this quite easily. Not sure if you tried it in xml just for proving a point. There is a bug report somewhere out there for it.