A11Y: improve poll history talkback behavior.
This commit is contained in:
parent
23cd587e2c
commit
282923840b
2 changed files with 16 additions and 4 deletions
|
|
@ -29,6 +29,8 @@ import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
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.text.style.TextAlign
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
@ -178,7 +180,9 @@ private fun PollHistoryList(
|
||||||
if (pollHistoryItems.isEmpty()) {
|
if (pollHistoryItems.isEmpty()) {
|
||||||
item {
|
item {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillParentMaxSize().padding(bottom = 24.dp),
|
modifier = Modifier
|
||||||
|
.fillParentMaxSize()
|
||||||
|
.padding(bottom = 24.dp),
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
) {
|
) {
|
||||||
|
|
@ -191,7 +195,9 @@ private fun PollHistoryList(
|
||||||
text = emptyStringResource,
|
text = emptyStringResource,
|
||||||
style = ElementTheme.typography.fontBodyLgRegular,
|
style = ElementTheme.typography.fontBodyLgRegular,
|
||||||
color = ElementTheme.colors.textSecondary,
|
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,
|
textAlign = TextAlign.Center,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -227,7 +233,10 @@ private fun PollHistoryItemRow(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Surface(
|
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),
|
border = BorderStroke(1.dp, ElementTheme.colors.borderInteractiveSecondary),
|
||||||
shape = RoundedCornerShape(size = 12.dp)
|
shape = RoundedCornerShape(size = 12.dp)
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,10 @@ class PollHistoryViewTest {
|
||||||
rule.setPollHistoryViewView(
|
rule.setPollHistoryViewView(
|
||||||
state = state,
|
state = state,
|
||||||
)
|
)
|
||||||
rule.onNodeWithText(answer.text).performClick()
|
rule.onNodeWithText(
|
||||||
|
text = answer.text,
|
||||||
|
useUnmergedTree = true,
|
||||||
|
).performClick()
|
||||||
eventsRecorder.assertSingle(
|
eventsRecorder.assertSingle(
|
||||||
PollHistoryEvents.SelectPollAnswer(eventId, answer.id)
|
PollHistoryEvents.SelectPollAnswer(eventId, answer.id)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue