Csaba Szugyiczki
12/02/2022, 12:43 PMColumn
listing nearby Stops.
These Stop items show which Lines stop there.
When Talkback reaches the Lines, I want it to add a prefix before starting to read out the line numbers which says “Departs from here: ” and then the line numbers, so in the screenshot it would read the name of the stop, then the distance from the stop and then: “Departs form here: bus 231, night bus 973, night bus 996, night bus 996A”
Currently I am adding a 1x1 Spacer before the Green box (which is a Column in my code) with the contentDescription
set to “Departs from here: ” but it feels like a nasty hack. Is there a better way to add a prefix to a group of elements?Jonas
12/02/2022, 12:59 PMCsaba Szugyiczki
12/02/2022, 1:08 PMCsaba Szugyiczki
12/02/2022, 1:09 PMJonas
12/02/2022, 1:10 PMCsaba Szugyiczki
12/02/2022, 1:34 PMdorche
12/02/2022, 9:36 PMAlbert Chang
12/03/2022, 4:33 AMAlbert Chang
12/03/2022, 4:35 AMCsaba Szugyiczki
12/03/2022, 10:53 AMcontentDescription
is that I did not find a way to evaluate what the system would assign as the default contentDescription
that I could alter myself.
In the good old View world we were iterating over the child Views, getting their contentDescriptions, appending them and then we had it.
Should I do the same here?Albert Chang
12/03/2022, 2:58 PMModifier.semantics(mergeDescendants = true) {
contentDescription = "Departs from here"
}
on the parent as the semantics of the parent come before the children when merged.Albert Chang
12/03/2022, 3:03 PMCsaba Szugyiczki
12/03/2022, 5:54 PMmergeDescendants
on the parent makes it a standalone item for TalkBack, so now the user has to manually change the focus in order to read out what is inside it.Csaba Szugyiczki
12/03/2022, 5:55 PMCsaba Szugyiczki
12/03/2022, 5:56 PMAlbert Chang
12/03/2022, 6:41 PMusing mergeDescendants on the parent makes it a standalone item for TalkBack
In that case, as I said before, use invisible element or rebuild the semantics yourself.
remember to update it whenever you change your content
You don't update the semantics in a declarative UI toolkit. You declare it. That's the whole point of "declarative".
Thats why it would be nice to retrieve the “original” merged contentDescription of the children
Iterating through children is intentionally prohibited in compose's design.
Csaba Szugyiczki
12/03/2022, 9:16 PMCsaba Szugyiczki
12/03/2022, 9:17 PMCsaba Szugyiczki
12/03/2022, 9:18 PM