A11Y: improve poll history talkback behavior.
This commit is contained in:
committed by
Benoit Marty
parent
23cd587e2c
commit
282923840b
@@ -29,6 +29,8 @@ import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.isTraversalGroup
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -178,7 +180,9 @@ private fun PollHistoryList(
|
||||
if (pollHistoryItems.isEmpty()) {
|
||||
item {
|
||||
Column(
|
||||
modifier = Modifier.fillParentMaxSize().padding(bottom = 24.dp),
|
||||
modifier = Modifier
|
||||
.fillParentMaxSize()
|
||||
.padding(bottom = 24.dp),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
@@ -191,7 +195,9 @@ private fun PollHistoryList(
|
||||
text = emptyStringResource,
|
||||
style = ElementTheme.typography.fontBodyLgRegular,
|
||||
color = ElementTheme.colors.textSecondary,
|
||||
modifier = Modifier.fillMaxWidth().padding(vertical = 24.dp, horizontal = 16.dp),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 24.dp, horizontal = 16.dp),
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
|
||||
@@ -227,7 +233,10 @@ private fun PollHistoryItemRow(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Surface(
|
||||
modifier = modifier,
|
||||
modifier = modifier.semantics(mergeDescendants = true) {
|
||||
// Allow the answers to be traversed by Talkback
|
||||
isTraversalGroup = true
|
||||
},
|
||||
border = BorderStroke(1.dp, ElementTheme.colors.borderInteractiveSecondary),
|
||||
shape = RoundedCornerShape(size = 12.dp)
|
||||
) {
|
||||
|
||||
@@ -131,7 +131,10 @@ class PollHistoryViewTest {
|
||||
rule.setPollHistoryViewView(
|
||||
state = state,
|
||||
)
|
||||
rule.onNodeWithText(answer.text).performClick()
|
||||
rule.onNodeWithText(
|
||||
text = answer.text,
|
||||
useUnmergedTree = true,
|
||||
).performClick()
|
||||
eventsRecorder.assertSingle(
|
||||
PollHistoryEvents.SelectPollAnswer(eventId, answer.id)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user