Skip to content

Instantly share code, notes, and snippets.

@Runman44
Created June 5, 2024 11:39
Show Gist options
  • Save Runman44/6765479dda3b7b081dbbfbe0940fb4b2 to your computer and use it in GitHub Desktop.
Save Runman44/6765479dda3b7b081dbbfbe0940fb4b2 to your computer and use it in GitHub Desktop.
Talkback modifiers
// Reads "One" -> "Two" -> "Three"
Row(modifier = Modifier.semantics(mergeDescendants = false) { }) {
Text("One")
Column {
Text("Two")
Text("Three")
}
}
// Reads "One Two Three"
Row(modifier = Modifier.semantics(mergeDescendants = true) { }) {
Text("One")
Column {
Text("Two")
Text("Three")
}
}
// Reads "One" -> "Two Three"
Row(modifier = Modifier.semantics(mergeDescendants = true) { }) {
Text("One")
Column(modifier = Modifier.semantics(mergeDescendants = true) { }) {
Text("Two")
Text("Three")
}
}
// Reads "Custom Description One Two Three"
Row(modifier = Modifier.semantics(mergeDescendants = true) {
contentDescription = "Custom Description"
}) {
Text("One")
Column {
Text("Two")
Text("Three")
}
}
// Reads "Custom Description"
Row(modifier = Modifier.clearAndSetSemantics {
contentDescription = "Custom Description"
}) {
Text("One")
Column {
Text("Two")
Text("Three")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment