Why can I set the `color` of `Text`, but not of `C...
# compose
t
Why can I set the
color
of
Text
, but not of
ClickableText
?
z
You can, through the
TextStyle
c
Yes, the text parameter of Text internally merges with a default declaration of TextStyle
Though I wonder if we should have a more “opinionated” ClickableText in the Material library layer that maybe has a specific theme color mapped. Since in the case with the current foundation ClickableText, it looks like it will be the same color as other Text if not changed manually.
z
I don’t think so.
ClickableText
is kind of a hacky workaround for the fact that we don’t have a good way to support clickable links in annotated strings yet, so it probably doesn’t make sense to propagate it to material. Whatever solution we end up for that should work with material’s theming too
c
Yeah, and I just checked the Material3 spec and they don’t seem to have any guidance on clickable text, e.g. links… My designer gut would say it’d use primary or something to stand out from the rest of the text
MaterialTheme.colors.hyperlinkBlue 😆
most hyperlinks are shorter than the 48dp×48dp minimum touch target size
I do have a custom
LinkMovementMethod
that implements browser-like touch slop adjustment for `android.widget.TextView`; maybe I should port that to Compose at some point. haven't needed it yet though
m
We have text like this in our app in two flavors: 1. Entire text highlighted (think more like a very bare bones button) 2. Partial text highlighted (like an html anchor embedded in a string) In both cases, we’re using Text with a clickable modifier for exactly the reason @ephemient mentioned. It’s an accessibility issue in terms of both the clickable target size, as well as the way that talkback would have the user navigate through. I know that in the xml world, we created a screen that had multiple clickable spans in the same text view, and it was a nightmare to navigate with talkback.