https://kotlinlang.org logo
#compose-android
Title
# compose-android
t

Thomas Hormes

03/23/2023, 9:38 AM
Hey, does it make any difference whether I set the content description of (for example) an
Icon
to
null
or
""
? Are they treated differently by e.g. screen readers?
h

Hugo Bernardi

03/23/2023, 9:45 AM
I think yes. According to the doc:
Some visual elements are purely decorative and you might not want to communicate them to the user. When you set the
contentDescription
parameter to
null
, you indicate to the Android framework that this element does not have associated actions or state.
An empty string might be "read" by screen readers, or at least user will be able to select it with an empty description.
14 Views