Open jber18 opened 6 days ago
I deliberately didn't want clicks to get intercepted at the top-level, so URLs would be clickable with their own handlers. One usually wants clicks to be handled at the lowest-level.
What level are you expecting to be clickable? The TextView? I assume you wouldn't want to also handle clicks on URLs or anything linkified in the same click handler?
Description:
When using the
MarkdownText
composable from the library, it renders the markdown content using anAndroidView
. However, I encountered an issue where adding aModifier.clickable
to theMarkdownText
or any of its parent containers does not register click events properly. This behavior creates conflicts when I try to wrap theMarkdownText
with clickable elements for interaction.Steps to Reproduce:
MarkdownText
in a Jetpack Compose component.Box
orRow
with aModifier.clickable
to detect taps.onClick
callback is never triggered.Expected Behavior:
Modifier.clickable
should register the click event when the markdown text is tapped.onClick
callback provided to theModifier.clickable
should be triggered.Actual Behavior:
clickable
modifier does not work when applied toMarkdownText
or its parent containers.AndroidView
used internally byMarkdownText
is blocking gesture events from reaching the Jetpack Compose layout.Possible Cause:
The
MarkdownText
composable usesAndroidView
under the hood to render markdown content via theMarkwon
library. SinceAndroidView
bridges the Android View system with Jetpack Compose, it consumes touch events internally, preventing them from propagating properly to the outer composables.This is a known issue when mixing
AndroidView
with Compose gesture handlers, as the Android view hierarchy does not seamlessly cooperate with the Compose UI system.Workaround Attempts:
I tried a few potential solutions, but none resolved the issue:
Suggested Solutions:
Expose a
onClick
callback directly in theMarkdownText
composable. This way, the click events can be handled internally within theAndroidView
.Example API:
Alternatively, provide guidance on how to integrate
MarkdownText
with Compose'sclickable
modifier or gesture detection.Environment:
latest
latest
latest