Casey Brooks

01/27/2022, 4:56 PM
For setting clickable links within text, we need to use AnnotatedString with ClickableText. However, I've noticed that the ClickableText consumes the pointer events even if the tap doesn't correspond to a clickable region of text, and thus a tap anywhere on the text doesn't fall-through to its parent. Is there any way to make only the clickable regions of text consume the pointer events?
For example, I've got a Card, and the whole thing is clickable. But within the card I've got ClickableText, and I only want specific text links within that to be intercepted. Clicks on other portions of that text should trigger the Card's
. Since the Card is mostly filled with this text, and may not even have links in it, it's difficult to actually trigger the card's onClick with the snippet used in the official docs


01/28/2022, 3:24 AM
Yeah, I had an idea a while back to hoist out the span positions and handle clicks in a layer on top of the text, but I never completed it. I think what we really need is a way to flow Composables in text, but that's a tall order with the Android text layout code.

Casey Brooks

01/28/2022, 4:10 PM
Yeah, that would be nice. You can add inline composables to the AnnotatedString, but you need to hardcode the size it should take up in the string. It looks like the issue is mainly with
not offering a way to return a boolean from the
callback to say whether a given event was actually handled.