Is there a way to make the cursor jump to the next...
# compose
a
Is there a way to make the cursor jump to the next TextField on (hardware keyboard) tab-press? Is there some way to enable this?
a
I'll check it out, thanks!
d
i guess KeyboardActions.onNext() might be useful, but I didn't try it myself
a
I can move to the next textfield fine with the onscreen keyboard via ImeAction.Next, it's with pressing tab on hardware keyboards that I have a problem. The textfield just adds a tab-character into the textfield instead of jumping to the next textfield.
this does not happen with xml based EditTexts
HardwareKeyboard support seems to be pretty basic at this point: For example when I set a TextField to singleline = true and then use the enter key I can still create multiple lines and type (the textfield wont expand, but the cursor disappears and I can type)
After some debugging I have found that compose textfields treat every native key command as a letter, so tabbing support with hardware keyboards does not exist
Copy code
internal actual val KeyEvent.isTypedEvent: Boolean
    get() = nativeKeyEvent.action == android.view.KeyEvent.ACTION_DOWN &&
        nativeKeyEvent.unicodeChar != 0
Maybe it's coming in the future?
r
Since this works differently from EditText, this is probably a bug
Filed https://issuetracker.google.com/197978180 to keep track of this
🙏 2