Can we add a "content description" to an image in compose?
c
Can we add a "content description" to an image in compose?
c
Pretty sure that's handled in semantics modifier?
If you're wanting it for accessibility or testing https://developer.android.com/jetpack/compose/testing. Im not sure if tooltips exist if that's what you want
c
I just have an image and want to make sure if someone uses an a11y reader like talkback that they can hear my description of the image. This will not be used for testing. I took a look at the Modifier.semantics but couldn't figure out any way to set a content description. There was an accessibilityLabel but it's deprecated.
c
Seems like that's what you want. Not sure what the replacement is if that's deprecated though https://bryanherbst.com/2020/11/03/compose-semantics-talkback/
👍 1
c
Thanks @Carson Holzheimer I'll keep trying it!
a
accessibilityLabel
was replaced with
contentDescription
. Both
Icon
and
Image
will have a parameter for it either in the next release or the one after. It was merged earlier this week. But still using
Modifier.semantics
under the hood. https://android-review.googlesource.com/c/platform/frameworks/support/+/1545989
👍 1
c
Thank you! The param for it will be helpful instead of wrapping it with modifier semantics.