Search code examples
androidandroid-jetpack-composetalkbackandroid-jetpack-compose-text

How to change Text's contentDescription on JetpackCompose


How can I change the default Text content description to be read on TalkBack on Jetpack Compose to any text that I want ?


Solution

  • As described in the accessibility documentation you can use the semantics modifier.
    You can use the contentDescription semantic property to set a custom content description:

    Text("First text", modifier = Modifier.semantics {
        this.contentDescription = "Custom content description" }
    )