Is there a way to keep the keyboard visible while displaying a dialog on top of it? Currently if the keyboard is displayed and then I trigger a dialog to show it hides the keyboard. I want it to stay open
s
Sean Proctor
05/16/2024, 9:15 PM
With Compose, the keyboard is shown when a component like a
TextField
is focused. If it loses focus, the keyboard will hide. Are you trying to type in a text field in the dialog? If so, focus it when the dialog is shown.
(LocalView.current.parent as DialogWindowProvider).window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
seems to work? 🤞 not sure how bad this hack is though
s
Sean Proctor
05/16/2024, 9:56 PM
Does the input still go into the text field? I think it would work if you capture focus on the text field when the dialog is launched, then free it on dismiss (if you want to allow the user to change the focus)
c
Chris Johnson
05/16/2024, 9:58 PM
the focus is still on the textfield but with that flag you can't interact with the textfield. This is the functionality I was looking for. AFAIK focus has no effect on making the keyboard stay on screen or not when a dialog is opened