diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/AutocompleteTextField.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/AutocompleteTextField.kt index 431f6d1..f439fb1 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/AutocompleteTextField.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/AutocompleteTextField.kt @@ -13,9 +13,7 @@ import androidx.compose.material.icons.filled.Close import androidx.compose.runtime.Composable import androidx.compose.runtime.* import androidx.compose.ui.Modifier -import androidx.compose.ui.focus.FocusDirection -import androidx.compose.ui.focus.FocusRequester -import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.focus.* import androidx.compose.ui.geometry.Size import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.platform.LocalDensity @@ -50,6 +48,7 @@ fun AutocompleteTextField( Box(Modifier.fillMaxWidth()) { OutlinedTextField( value = searchQuery, + singleLine = true, onValueChange = { query -> searchQuery = query onValueChange(null) @@ -88,7 +87,8 @@ fun AutocompleteTextField( suggestions = emptyList() expanded = false onValueChange(null) - } + textFieldFocus.requestFocus() + }.focusProperties { canFocus = false } ) } }, @@ -113,6 +113,8 @@ fun AutocompleteTextField( searchQuery = it.invoke(item) } expanded = false + + textFieldFocus.freeFocus() focusManager.moveFocus(FocusDirection.Down) } ) {