Allow text selection on GtkLabel

I’m trying to allow the user to select the text present in a GtkLabel and copy it to the clipboard. I’ve stumbled upon set_selectable(bool), however when I try it on GtkLabel, after I click on it a caret appears.

Text selection however works:

Is there a way to hide the caret? Basically, I want the text selection to behave just like in the browser.

You may try to make the caret invisible with CSS:

label {
    caret-color: transparent;
1 Like

That seems to do the job, except it also hides the highlighting. Highlighting for reference:
Which makes copying text inconvenient because the selection is visible only when dragging the cursor: