0

In my Jetpack Compose app, it seems that any time I open a popup such as DropdownMenu while I'm typing something, the keyboard will disappear. Perhaps this happens because the TextField loses focus? I can't find why this happens.

For my use case this is very jarring and I would like the IME to remain up while the DropdownMenu is opened. Is this possible to achieve? It seems to be the default behavior for non-Compose apps. See attached animations for comparison.

Keyboard being dismissed when menu is opened Keyboard not being dismissed when menu is opened

1 Answer 1

1

If you set properties = PopupProperties(focusable = false) opening DropDownMenu won't dismiss keyboard.

But when setting focusable to false clicking another item will invoke click action if available. By default DropDownMenu handles this click and consume but with false it doesn't.

If you also need to prevent this you can have custom click on parent or root Composable by change propagation direction with PointerEventPass.Initial and consume event.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.