[a11y] Add heading() to date separators.

This commit is contained in:
Benoit Marty
2025-07-04 12:16:05 +02:00
parent 4afc20798c
commit a464e5c99f
2 changed files with 12 additions and 1 deletions

View File

@@ -14,6 +14,8 @@ import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.heading
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import io.element.android.compound.theme.ElementTheme
@@ -36,6 +38,10 @@ internal fun TimelineItemDaySeparatorView(
contentAlignment = Alignment.Center,
) {
Text(
modifier = modifier
.semantics {
heading()
},
text = model.formattedDate,
style = ElementTheme.typography.fontBodyMdMedium,
color = ElementTheme.colors.textPrimary,

View File

@@ -11,6 +11,8 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.heading
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
@@ -28,7 +30,10 @@ fun DateItemView(
Text(
modifier = modifier
.fillMaxWidth()
.padding(12.dp),
.padding(12.dp)
.semantics {
heading()
},
text = item.formattedDate,
textAlign = TextAlign.Center,
style = ElementTheme.typography.fontBodyMdMedium,