I am using `BasicTextField` when I clear the focus...
# compose
k
I am using
BasicTextField
when I clear the focus with
focusRequester.freeFocus()
the keyboard disappears but the cursor is still inside the TextField. Is there a good way to make it disappear once the view is not focused?
Found the solution, I need both
Copy code
focusRequester.freeFocus()
focusManager.clearFocus()
z
@Ralston Da Silva Is the keyboard disappearing on freeFocus expected behavior? IIUC it should move the field out of the captured state but leave it focused, in which case the keyboard should remain I would think.
r
I think for this use case you only need clearFocus()
FocusRequester.captureFocus() and FocusRequester.freeFocus() go together
To Zach's question, freeFocus() should be a no-op if captureFocus() wasn't called before. This looks like a bug
👍🏻 1
z
k
I found that some hide keyboard logic was still left on the fragement level and this is why the focus remained, but the keyboard disappeared. I also called capturFocus so the freeFocus is needed.