HtmlText icon indicating copy to clipboard operation
HtmlText copied to clipboard

onClick/clickable functionality breaks when using HtmlText

Open DFreds opened this issue 3 years ago • 0 comments

If a parent composable is listening for clicks, the HtmlText stops the clicks from occurring. Here is an example:

    Column {
        Card(
            modifier = Modifier.clickable {
                println("Clicked the html card!") // never triggers
            }
        ) {
            HtmlText(text = "Some <b>bolded and cool</b> text that should click")
        }

        Button(
            onClick = {
                println("Clicked the html button!") // never triggers
            }
        ) {
            HtmlText(text = "Some <b>bolded and cool</b> button")
        }

        Card(
            modifier = Modifier.clickable {
                println("Clicked the non-html card!") // always triggers
            }
        ) {
            Text(text = "Some <b>bolded and cool</b> text that should click")
        }

        Button(
            onClick = {
                println("Clicked the non-html button!") // always triggers
            }
        ) {
            Text(text = "Some <b>bolded and cool</b> button")
        }
    }

What it looks like in preview: image

DFreds avatar Aug 26 '22 20:08 DFreds