Jetpack compose soft keyboard opens up when switching apps

Viewed 643

A weird bug in my current app that was created using Jetpack Compose.

Issue: Once the soft keyboard is opened in the app, due to any screen with TextField, the keyboard is shown every time when switching from a different app to this one.

Video

Unable to provide a minimal reproducible code as I can't figure out which code is causing this issue and I noticed this quite late as I didn't expect a bug when switching apps.

The whole source code is on Github: https://github.com/Abhimanyu14/finance-manager/tree/main/codebase/android.

Kindly comment if any particular code might help.


Adding keyboard-related code I can think of which might have an impact.

The keyboard is hidden whenever composable navigation happens,

Using LocalSoftwareKeyboardController,

val keyboardController = LocalSoftwareKeyboardController.current
keyboardController?.hide()
1 Answers
Related