Is there an easy way to for text to be highlighted...
# compose-web
l
Is there an easy way to for text to be highlighted and copied to clipboard? Afaik since it’s on the canvas this isn’t possible without manual implementation. Perhaps there’s something already made?
s
You can use the
SelectionContainer
composable to wrap your composables to make them selectable
But I'm not sure how well does that work on web for now (Ctrl-C, etc...). And since Compose Web doesn't generate HTML elements for accessibility yet (which, for selectable text elements, doubles as a hidden selectable text) you won't get the browser's native context menu for it.
l
I will have to make my own context menu and use the clipboard api then?
s
Normally
SelectionContainer
does that for you, at least that's how it works on desktop, haven't tried on web though