Hey, y’all! I am curious to know more about why a...
# compose
l
Hey, y’all! I am curious to know more about why a
Text
that is fed an
AnnotatedString
with a
LinkAnnotation
is focused first on a given screen? Code and media in the 🧵
Copy code
Scaffold(
    topBar = {
        TopAppBar(title = { Text("Talkback Testing") })
    },
    ...
) { innerPadding ->
    Column(...) {
        Text("First normal text element")

        Text(
            buildAnnotatedString {
                append("If I could click something, I would click ")
                val link =
                    LinkAnnotation.Clickable(
                        "special_tag",
                        TextLinkStyles(SpanStyle(color = Color.Blue))
                    ) {
                        println("Clickable link clicked")
                    }
                withLink(link) { append("here") }
                append(".")
            }
        )

        Text("Second normal text element")
    }
}
This code yields this behavior:
Notice how Talkback focus doesn’t start at the top bar, it starts at the
AnnotatedString
filled
Text
and then goes to the top bar. This does seem a bit odd, but I am not an accessibility user, so I am curious if this is intended behavior and why? Otherwise I will submit an issue and try and devise a work around ❤️
d
If you replace the Scaffold with a Column, does that impact the behaviour?
l
It does not.
sad panda