compose-richtext icon indicating copy to clipboard operation
compose-richtext copied to clipboard

Clickable links in SelectionContainer are no longer clickable

Open sebkur opened this issue 1 year ago • 2 comments

Here's an example. With the SelectionContainer selecting the text is possible, but clicking the link does nothing. Without it, clicking the link works, but selecting text doesn't work of course:

import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.singleWindowApplication
import com.halilibo.richtext.markdown.Markdown
import com.halilibo.richtext.ui.RichText

fun main() {
    singleWindowApplication {
        LazyColumn {
            item {
                Text("Foo")
            }
            item {
                SelectionContainer {
                    RichText(modifier = Modifier.padding(vertical = 8.dp).fillMaxWidth()) {
                        Markdown("[Google](https://www.google.com)", onLinkClicked = { link ->
                            println(link)
                        })
                    }
                }
            }
        }
    }
}

Is there some other way to make text selectable or is this is a bug?

sebkur avatar Dec 06 '22 17:12 sebkur