From 5a923d5492002350717ff30bfb5b70658c142e95 Mon Sep 17 00:00:00 2001 From: Annabella Koch Date: Fri, 27 Sep 2024 13:48:40 -0700 Subject: [PATCH] Announce error messages in TalkBack --- .../com/stripe/android/paymentsheet/ui/ErrorMessage.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/ErrorMessage.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/ErrorMessage.kt index 498af62b7cb..1f336f6db65 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/ErrorMessage.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/ErrorMessage.kt @@ -8,6 +8,9 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.semantics.LiveRegionMode +import androidx.compose.ui.semantics.liveRegion +import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.unit.dp import androidx.core.content.res.ResourcesCompat @@ -41,6 +44,8 @@ internal fun ErrorMessage( fontSize = fontSize, color = MaterialTheme.colors.error, fontFamily = FontFamily(typeface), - modifier = modifier, + modifier = modifier.semantics { + this.liveRegion = LiveRegionMode.Assertive + }, ) }