Focusable GTK4 labels

Hello,

Since GTK4 labels are no longer focusable, however I have found focusable labels in the wild and I am trying to learn how to make the label focusable with the keyboard and allow text selection.

I am looking at two examples.

Within the gnome-podcasts app there is a label holding the podcast episode description which is focusable and text can be selected and copyed.
That label is described inside the ui file like this.

                      <object class="GtkLabel" id="description">
                        <property name="valign">start</property>
                        <property name="margin-start">18</property>
                        <property name="margin-end">18</property>
                        <property name="margin-bottom">18</property>
                        <property name="label" translatable="yes">Episode Description</property>
                        <property name="wrap">True</property>
                        <property name="wrap-mode">word-char</property>
                        <property name="xalign">0</property>
                        <style>
                          <class name="episode_description_label"/>
                        </style>
                      </object>

In the shortwave app there is a label wit the currently playing track title. This one is not focusable with the keyboard and the text can’t be selected.
It’s described inside the ui file like this.

                                  <object class="GtkLabel" id="track_label">
                                    <property name="margin_top">6</property>
                                    <property name="justify">center</property>
                                    <property name="ellipsize">end</property>
                                    <property name="wrap">True</property>
                                    <property name="lines">2</property>
                                    <binding name="label">
                                      <lookup name="title" type="SwTrack">
                                        <lookup name="playing-track" type="SwPlayer">
                                          <lookup name="player">SwPlayerView</lookup>
                                        </lookup>
                                      </lookup>
                                    </binding>
                                  </object>

Please can you help me to understand this?
Does it something to do with these labels, or is relation to the other widgets important here?

Thanks and greetings

Peter

Text in a label can be made selectable using the selectable property.

Since your first code snippet does not include this property, I would assume the property is set in the code when the description is added.
But it is settable in the UI file.

Thank you for the hint, it’s verry helpfull and answers mi question perfectly. The gnome-podcasts app does do much more a11y related within the code rather than UI and I’m discovering it’s for a reason.
I guess I’ll start another topic very soon.

Thanks and greetings

Peter