diff options
author | Corey Berla <corey@berla.me> | 2022-08-31 15:42:49 +0000 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-08-31 15:42:49 +0000 |
commit | ee38cbef43784412147547648298de1db667c39c (patch) | |
tree | ad028f97b8f06b852da32597f48096352695609a /src/nautilus-list-view.c | |
parent | dff737342dec23ab3a71eff4a0a6a4a9a8cd5712 (diff) | |
download | nautilus-ee38cbef43784412147547648298de1db667c39c.tar.gz |
general: Set labelled-by for view cells
In gtk4, we need to set labelled-by to help a11y programs know what
it currently selected.
Unfortunately, the focus is on a GTK internal widget, so at the moment
this solution requires a hack: we mark the internal list item widget as
being labeled by our cell (which is, in turn, labeled by the filename label).
We are reporting this to GTK to work toward a better solution.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2460
Diffstat (limited to 'src/nautilus-list-view.c')
-rw-r--r-- | src/nautilus-list-view.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c index e2389eac3..4b7a5f2e1 100644 --- a/src/nautilus-list-view.c +++ b/src/nautilus-list-view.c @@ -945,11 +945,27 @@ bind_name_cell (GtkSignalListItemFactory *factory, GtkListItem *listitem, gpointer user_data) { + GtkWidget *cell; NautilusViewItem *item; + cell = gtk_list_item_get_child (listitem); item = NAUTILUS_VIEW_ITEM (gtk_list_item_get_item (listitem)); nautilus_view_item_set_item_ui (item, gtk_list_item_get_child (listitem)); + + if (nautilus_view_cell_once (NAUTILUS_VIEW_CELL (cell))) + { + GtkWidget *row_widget; + + /* At the time of ::setup emission, the item ui has got no parent yet, + * that's why we need to complete the widget setup process here, on the + * first time ::bind is emitted. */ + row_widget = gtk_widget_get_parent (gtk_widget_get_parent (cell)); + + gtk_accessible_update_relation (GTK_ACCESSIBLE (row_widget), + GTK_ACCESSIBLE_RELATION_LABELLED_BY, cell, NULL, + -1); + } } static void |