Merge branch 'let_selectable_label_mnemonic_self_focus' into 'main'

Allow selectable labels contents to be selected by mnemonic

See merge request GNOME/gtk!4741
This commit is contained in:
Matthias Clasen
2022-05-18 13:55:33 +00:00

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.
*/