From 14a64c737291ea9d0d03539febbe59bcf0da49bc Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Oct 2020 15:04:06 -0400 Subject: [PATCH] levelbar: Hide internal structure from a11y According to section 7.1 of WAI-ARIA, the meter role has the "Children presentational" characteristic, which indicates that children should not be represented in the a11y tree. --- gtk/gtklevelbar.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c index 5c005e1262..a62968b3f1 100644 --- a/gtk/gtklevelbar.c +++ b/gtk/gtklevelbar.c @@ -540,7 +540,9 @@ update_block_nodes (GtkLevelBar *self) self->block_widget = g_renew (GtkWidget*, self->block_widget, n_blocks); for (i = self->n_blocks; i < n_blocks; i++) { - self->block_widget[i] = gtk_gizmo_new ("block", NULL, NULL, NULL, NULL, NULL, NULL); + self->block_widget[i] = gtk_gizmo_new_with_role ("block", + GTK_ACCESSIBLE_ROLE_NONE, + NULL, NULL, NULL, NULL, NULL, NULL); gtk_widget_insert_before (self->block_widget[i], GTK_WIDGET (self->trough_widget), NULL); } self->n_blocks = n_blocks; @@ -1024,12 +1026,13 @@ gtk_level_bar_init (GtkLevelBar *self) self->inverted = FALSE; - self->trough_widget = gtk_gizmo_new ("trough", - gtk_level_bar_measure_trough, - gtk_level_bar_allocate_trough, - gtk_level_bar_render_trough, - NULL, - NULL, NULL); + self->trough_widget = gtk_gizmo_new_with_role ("trough", + GTK_ACCESSIBLE_ROLE_NONE, + gtk_level_bar_measure_trough, + gtk_level_bar_allocate_trough, + gtk_level_bar_render_trough, + NULL, + NULL, NULL); gtk_widget_set_parent (self->trough_widget, GTK_WIDGET (self)); gtk_level_bar_ensure_offset (self, GTK_LEVEL_BAR_OFFSET_LOW, 0.25);