Skip to content

Commit

Permalink
Announce error messages in TalkBack
Browse files Browse the repository at this point in the history
  • Loading branch information
amk-stripe committed Sep 27, 2024
1 parent 4e154a7 commit 5a923d5
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
},
)
}

0 comments on commit 5a923d5

Please sign in to comment.