diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/TransferMoneyDialog.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/TransferMoneyDialog.kt index 9b961df..f15607c 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/TransferMoneyDialog.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/TransferMoneyDialog.kt @@ -72,6 +72,8 @@ fun TransferMoneyDialog( var isTransferringMoney by remember { mutableStateOf(false) } + val recipientNameFocus = remember { FocusRequester() } + val amountFocus = remember { FocusRequester() } val verticalSpace = 8.dp @@ -147,6 +149,7 @@ fun TransferMoneyDialog( recipientName, dropdownMaxHeight = 350.dp, minTextLengthForSearch = 0, + textFieldFocus = recipientNameFocus, onEnteredTextChanged = { recipientName = it }, getItemTitle = { suggestion -> suggestion.name }, onSelectedItemChanged = { @@ -269,6 +272,8 @@ fun TransferMoneyDialog( coroutineScope.launch { recipientFinder.updateData(bankingService.getAllAccountTransactions()) // only a bit problematic: if in the meantime new transactions are retrieved, then RecipientFinder doesn't contain the newly retrieved transactions + + recipientNameFocus.requestFocus() } } } 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 bf92d3d..367b895 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 @@ -28,6 +28,7 @@ fun AutocompleteTextField( getItemTitle: ((T) -> String)? = null, dropdownMaxHeight: Dp = 400.dp, modifier: Modifier = Modifier, + textFieldFocus: FocusRequester = remember { FocusRequester() }, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, leadingIcon: @Composable (() -> Unit)? = null, fetchSuggestions: suspend (query: String) -> Collection = { emptyList() }, @@ -38,8 +39,6 @@ fun AutocompleteTextField( var suggestions by remember { mutableStateOf>(emptyList()) } var suggestionsFetchJob: Job? = null - val textFieldFocus = remember { FocusRequester() } - val coroutineScope = rememberCoroutineScope()