https://kotlinlang.org logo
Title
m

myanmarking

01/05/2022, 1:37 PM
is there any way to query the modifier for a specific attribute, like contentDescription. In a child composable, i want to be able to extract the parent contentDescription so i can append to child contentDescription name. What would be the best approach of doing this ? I have access to parent modifier
z

Zach Klippenstein (he/him) [MOD]

01/07/2022, 5:28 PM
This is not possible to do manually, you can't query modifier objects for semantics. I can’t remember how content description merging works but I would think it should append for you, like text does.
Do you should just be able to set the content description on your child and then tell the parents to merge semantics
m

myanmarking

01/07/2022, 5:36 PM
can you ellaborate? How to tell the parent to merge ?
z

Zach Klippenstein (he/him) [MOD]

01/07/2022, 5:49 PM
Modifier.semantics(mergeDescendants = true)