[gtk/matthiasc/for-master] progressbar: Hide internal structure from a11y



commit d3089ebbc261895b423ee6deaebacfc5ec17c29a
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Oct 21 15:09:55 2020 -0400

    progressbar: Hide internal structure from a11y
    
    According to section 7.1 of WAI-ARIA, the progressbar role
    has the "Children presentational" characteristic, which
    indicates that children should not be represented in
    the a11y tree.

 gtk/gtkprogressbar.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index 819cc5eb59..30a91d447c 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -446,15 +446,18 @@ gtk_progress_bar_init (GtkProgressBar *pbar)
   pbar->text = NULL;
   pbar->fraction = 0.0;
 
-  pbar->trough_widget = gtk_gizmo_new ("trough",
-                                       NULL,
-                                       allocate_trough,
-                                       NULL,
-                                       NULL,
-                                       NULL, NULL);
+  pbar->trough_widget = gtk_gizmo_new_with_role ("trough",
+                                                 GTK_ACCESSIBLE_ROLE_NONE,
+                                                 NULL,
+                                                 allocate_trough,
+                                                 NULL,
+                                                 NULL,
+                                                 NULL, NULL);
   gtk_widget_set_parent (pbar->trough_widget, GTK_WIDGET (pbar));
 
-  pbar->progress_widget = gtk_gizmo_new ("progress", NULL, NULL, NULL, NULL, NULL, NULL);
+  pbar->progress_widget = gtk_gizmo_new_with_role ("progress",
+                                                   GTK_ACCESSIBLE_ROLE_NONE,
+                                                   NULL, NULL, NULL, NULL, NULL, NULL);
   gtk_widget_set_parent (pbar->progress_widget, pbar->trough_widget);
 
   /* horizontal is default */
@@ -874,6 +877,7 @@ gtk_progress_bar_set_show_text (GtkProgressBar *pbar,
       char *text = get_current_text (pbar);
 
       pbar->label = g_object_new (GTK_TYPE_LABEL,
+                                  "accessible-role", GTK_ACCESSIBLE_ROLE_NONE,
                                   "css-name", "text",
                                   "label", text,
                                   "ellipsize", pbar->ellipsize,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]