diff --git a/CHANGELOG.md b/CHANGELOG.md index d999371508..63edbeb75d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. * ui: add quiet zone as background to the exit code and adjust the brightness if it is shown ### Removed ### Fixed +* ui: Add missing focus to the product search field after opening the `ProductSearchView` ## [0.80.1] ### Fixed diff --git a/ui/src/main/java/io/snabble/sdk/ui/search/ProductSearchView.kt b/ui/src/main/java/io/snabble/sdk/ui/search/ProductSearchView.kt index c6922239aa..07f3af5d70 100644 --- a/ui/src/main/java/io/snabble/sdk/ui/search/ProductSearchView.kt +++ b/ui/src/main/java/io/snabble/sdk/ui/search/ProductSearchView.kt @@ -17,6 +17,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction @@ -80,14 +81,17 @@ open class ProductSearchView @JvmOverloads constructor( var searchedCode by remember { mutableStateOf("") } LaunchedEffect(Unit) { - focusRequester.requestFocus() textFieldManager.showKeyboard() } + Box(modifier = Modifier.padding(8.dp)) { TextInput( modifier = Modifier .fillMaxWidth() - .focusRequester(focusRequester), + .focusRequester(focusRequester) + .onGloballyPositioned { + focusRequester.requestFocus() + }, value = searchedCode, label = stringResource(id = R.string.Snabble_Scanner_enterBarcode), keyboardOptions = KeyboardOptions(