Fix missing focus when single TextField shown (#8098)
This commit is contained in:
parent
e2ce3f68bf
commit
f19c288bec
2 changed files with 2 additions and 5 deletions
|
@ -70,7 +70,7 @@ fun CategoryRenameDialog(
|
||||||
category: Category,
|
category: Category,
|
||||||
) {
|
) {
|
||||||
val (name, onNameChange) = remember { mutableStateOf(category.name) }
|
val (name, onNameChange) = remember { mutableStateOf(category.name) }
|
||||||
val focusRequester = remember { FocusRequester.Default }
|
val focusRequester = remember { FocusRequester() }
|
||||||
|
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
|
|
|
@ -41,7 +41,6 @@ import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppBar(
|
fun AppBar(
|
||||||
|
@ -225,7 +224,7 @@ fun SearchToolbar(
|
||||||
downloadedOnlyMode: Boolean = false,
|
downloadedOnlyMode: Boolean = false,
|
||||||
scrollBehavior: TopAppBarScrollBehavior? = null,
|
scrollBehavior: TopAppBarScrollBehavior? = null,
|
||||||
) {
|
) {
|
||||||
val focusRequester = remember { FocusRequester.Default }
|
val focusRequester = remember { FocusRequester() }
|
||||||
AppBar(
|
AppBar(
|
||||||
titleContent = {
|
titleContent = {
|
||||||
BasicTextField(
|
BasicTextField(
|
||||||
|
@ -256,8 +255,6 @@ fun SearchToolbar(
|
||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
)
|
)
|
||||||
LaunchedEffect(focusRequester) {
|
LaunchedEffect(focusRequester) {
|
||||||
// TODO: https://issuetracker.google.com/issues/204502668
|
|
||||||
delay(100)
|
|
||||||
focusRequester.requestFocus()
|
focusRequester.requestFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue