diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/EditListPreference.kt b/app/src/main/java/com/geeksville/mesh/ui/components/EditListPreference.kt index 3a85c1c0..5f7e08e0 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/EditListPreference.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/EditListPreference.kt @@ -20,6 +20,7 @@ import androidx.compose.runtime.mutableStateListOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType @@ -41,6 +42,7 @@ inline fun EditListPreference( crossinline onValuesChanged: (List) -> Unit, modifier: Modifier = Modifier, ) { + val focusManager = LocalFocusManager.current val listState = remember(list) { mutableStateListOf().apply { addAll(list) } } Column(modifier = modifier) { @@ -65,6 +67,7 @@ inline fun EditListPreference( trailingIcon = { IconButton( onClick = { + focusManager.clearFocus() listState.removeAt(index) onValuesChanged(listState) } @@ -109,6 +112,7 @@ inline fun EditListPreference( trailingIcon = { IconButton( onClick = { + focusManager.clearFocus() listState.removeAt(index) onValuesChanged(listState) }