Allow selectable labels contents to be selected by mnemonic

expecially by the mnemonic of another label that targets it.

https://gitlab.gnome.org/GNOME/gtk/-/issues/4927

see also https://bugs.documentfoundation.org/show_bug.cgi?id=137748
This commit is contained in:
Caolán McNamara 2022-05-18 12:40:40 +01:00
parent 26b250503d
commit 3f49d335d1

View File

@ -2020,6 +2020,12 @@ gtk_label_mnemonic_activate (GtkWidget *widget,
if (self->mnemonic_widget)
return gtk_widget_mnemonic_activate (self->mnemonic_widget, group_cycling);
/* Not a label for something else, but is selectable, so set focus into
* the label itself.
*/
if (gtk_label_get_selectable (self) && gtk_widget_get_focusable (widget))
return gtk_label_grab_focus (widget);
/* Try to find the widget to activate by traversing the
* widget's ancestry.
*/