Skip to content

Commit ca8298b

Browse files
committed
[a11y] Group emoji labels so that they are read out all together.
1 parent 62b2bba commit ca8298b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

features/verifysession/impl/src/main/kotlin/io/element/android/features/verifysession/impl/ui/VerificationContentVerifying.kt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import androidx.compose.ui.Alignment
2424
import androidx.compose.ui.Modifier
2525
import androidx.compose.ui.res.painterResource
2626
import androidx.compose.ui.res.stringResource
27+
import androidx.compose.ui.semantics.contentDescription
28+
import androidx.compose.ui.semantics.semantics
2729
import androidx.compose.ui.text.style.TextAlign
2830
import androidx.compose.ui.text.style.TextOverflow
2931
import androidx.compose.ui.unit.dp
@@ -39,14 +41,20 @@ internal fun VerificationContentVerifying(
3941
modifier: Modifier = Modifier,
4042
) {
4143
Box(
42-
modifier = modifier.fillMaxSize().padding(bottom = 20.dp),
44+
modifier = modifier
45+
.fillMaxSize()
46+
.padding(bottom = 20.dp),
4347
contentAlignment = Alignment.Center
4448
) {
4549
when (data) {
4650
is SessionVerificationData.Decimals -> {
47-
val text = data.decimals.joinToString(separator = " - ") { it.toString() }
51+
val text = data.decimals.joinToString(separator = " - ")
4852
Text(
49-
modifier = Modifier.fillMaxWidth(),
53+
modifier = Modifier
54+
.fillMaxWidth()
55+
.semantics {
56+
contentDescription = data.decimals.joinToString()
57+
},
5058
text = text,
5159
style = ElementTheme.typography.fontHeadingLgBold,
5260
color = ElementTheme.colors.textPrimary,
@@ -57,7 +65,9 @@ internal fun VerificationContentVerifying(
5765
// We want each row to have up to 4 emojis
5866
val rows = data.emojis.chunked(4)
5967
Column(
60-
modifier = Modifier.fillMaxWidth(),
68+
modifier = Modifier
69+
.fillMaxWidth()
70+
.semantics(mergeDescendants = true) {},
6171
verticalArrangement = Arrangement.spacedBy(40.dp),
6272
) {
6373
rows.forEach { emojis ->

0 commit comments

Comments
 (0)