0

You have a component with a textfield

@Composable
fun Test() {
  BasicTextField("hi", { })
}

You click on the text field. The soft keyboard appears.

You close the soft keyboard with the keyboard icon below.

enter image description here.

The keybaord is gone. But the text is still selected.

enter image description here

Press the back button, the text is unselected. Press again: you exit the app.

Is is possible to have unselected text when the keyboard is dismissed as above? And so meaning you need only one back press to either exit the app or go back to the previous screen?

Or put another way: why is focusing on editable text adding to the back stack?

(Note: if I could detect when the keyboard is dismissed in jetpack compose, I could unselect the text, but I'm found now way to detect this currently).

mmm111mmm
  • 3,607
  • 4
  • 27
  • 44
  • Thanks Philip. It helps a little. I think that's the issue. But your code doesn't fix the problem on its own. Is it correct you have https://google.github.io/accompanist/insets/ installed in your project? – mmm111mmm Aug 19 '21 at 10:44
  • yes, I probably should add it to my answer, because it's not a part of compose, thanks – Phil Dukhov Aug 19 '21 at 10:52
  • To make your answer easier to search for, I'd consider mentioning two back presses in the title. I was searching for a solution and couldn't find your answer. – mmm111mmm Aug 19 '21 at 10:54

0 Answers0