Zach Klippenstein (he/him) [MOD]
06/10/2021, 7:50 PMcontentDescription
doesn’t get merged up? More details in the thread on the original message.Adam Powell
06/10/2021, 10:24 PMAlexandre Elias [G]
06/10/2021, 10:32 PMAlexandre Elias [G]
06/10/2021, 10:34 PMassertContentDescriptionContains
would fix it, 2) the child with the contentDescription is itself mergeDescendants
which would exclude it from mergingAlexandre Elias [G]
06/10/2021, 10:38 PMZach Klippenstein (he/him) [MOD]
06/10/2021, 11:42 PM1) you have additional contentDescriptions, in which caseWondered about this because i’ve been bit before, but I’ve looked at the actual semantics node and there’s no content description properties there at all.would fixassertContentDescriptionContains
2) the child with the contentDescription is itselfI thought about this too but was pretty sure we weren’t doing it. I’ve double-checked, and we’re not. The material components seem to have the same problem. This test, for example, fails:which would exclude it from mergingmergeDescendants
rule.setContent {
// As far as i can tell from the source, IconButton merges descendants and does not provide its own contentDescription.
IconButton(
onClick = {},
modifier = Modifier.testTag(testTag)
) {
// Icon does not merge its descendents, so this content description should merge up.
Icon(painterResource(R.drawable.abc_vector_test), contentDescription)
}
}
rule.onNodeWithTag(testTag).assertContentDescriptionContains(contentDescription)
I’m gonna try to debug the actual semantics merging now to see what’s going on.Zach Klippenstein (he/him) [MOD]
06/10/2021, 11:43 PMval ContentDescription = SemanticsPropertyKey<String>(
name = "ContentDescription",
mergePolicy = { parentValue, _ -> parentValue }
)
(We can’t use beta08 yet because of a compiler plugin bug.)Alexandre Elias [G]
06/10/2021, 11:47 PMAlexandre Elias [G]
06/10/2021, 11:50 PMclearAndSetSemantics
to be the only thing that does that so we're not terribly fond of this behavior. recently we worked around it in the accessibility implementation and switched the merged tree to what most developers expectAlexandre Elias [G]
06/10/2021, 11:51 PMZach Klippenstein (he/him) [MOD]
06/10/2021, 11:51 PMAlexandre Elias [G]
06/10/2021, 11:54 PMZach Klippenstein (he/him) [MOD]
06/10/2021, 11:58 PMAlexandre Elias [G]
06/11/2021, 12:00 AMAlexandre Elias [G]
06/11/2021, 12:04 AMmergeDescendants
property still has a big impact on accessibility since we represent it as screenReaderFocusable
which makes TalkBack do the merging, using essentially the same algorithm that Compose doesZach Klippenstein (he/him) [MOD]
06/11/2021, 2:30 PM