diff options
| author | 2024-12-03 22:56:14 +0000 | |
|---|---|---|
| committer | 2024-12-03 22:56:14 +0000 | |
| commit | fb8adfb74f8bec21d0c6aa848d30876f751427ac (patch) | |
| tree | 4f40d2d164927a0c937130c7689a7f7f6ececed2 | |
| parent | 5755c77f145769f8ca6920c710db30b465b9501e (diff) | |
| parent | bc29c821a7fe294a9a46486384bd711f33958daf (diff) | |
Merge "Set default focus for a11y in oobe tutorial screen." into main
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/inputdevice/tutorial/ui/composable/ActionTutorialContent.kt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/inputdevice/tutorial/ui/composable/ActionTutorialContent.kt b/packages/SystemUI/src/com/android/systemui/inputdevice/tutorial/ui/composable/ActionTutorialContent.kt index 1b044de5cf63..0c1bc835517a 100644 --- a/packages/SystemUI/src/com/android/systemui/inputdevice/tutorial/ui/composable/ActionTutorialContent.kt +++ b/packages/SystemUI/src/com/android/systemui/inputdevice/tutorial/ui/composable/ActionTutorialContent.kt @@ -20,6 +20,7 @@ import android.content.res.Configuration import androidx.annotation.RawRes import androidx.compose.animation.core.animateFloatAsState import androidx.compose.foundation.background +import androidx.compose.foundation.focusable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -33,8 +34,12 @@ import androidx.compose.foundation.layout.width import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue +import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.platform.LocalConfiguration @@ -125,6 +130,8 @@ fun TutorialDescription( config: TutorialScreenConfig, modifier: Modifier = Modifier, ) { + val focusRequester = remember { FocusRequester() } + LaunchedEffect(Unit) { focusRequester.requestFocus() } val (titleTextId, bodyTextId) = if (actionState is Finished) { config.strings.titleSuccessResId to config.strings.bodySuccessResId @@ -136,6 +143,7 @@ fun TutorialDescription( text = stringResource(id = titleTextId), style = MaterialTheme.typography.displayLarge, color = config.colors.title, + modifier = Modifier.focusRequester(focusRequester).focusable(), ) Spacer(modifier = Modifier.height(16.dp)) Text( |