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.
This commit is contained in:
Matthias Clasen 2020-10-21 15:09:55 -04:00
parent 14a64c7372
commit d3089ebbc2

View File

@ -446,15 +446,18 @@ gtk_progress_bar_init (GtkProgressBar *pbar)
pbar->text = NULL; pbar->text = NULL;
pbar->fraction = 0.0; pbar->fraction = 0.0;
pbar->trough_widget = gtk_gizmo_new ("trough", pbar->trough_widget = gtk_gizmo_new_with_role ("trough",
NULL, GTK_ACCESSIBLE_ROLE_NONE,
allocate_trough, NULL,
NULL, allocate_trough,
NULL, NULL,
NULL, NULL); NULL,
NULL, NULL);
gtk_widget_set_parent (pbar->trough_widget, GTK_WIDGET (pbar)); 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); gtk_widget_set_parent (pbar->progress_widget, pbar->trough_widget);
/* horizontal is default */ /* horizontal is default */
@ -874,6 +877,7 @@ gtk_progress_bar_set_show_text (GtkProgressBar *pbar,
char *text = get_current_text (pbar); char *text = get_current_text (pbar);
pbar->label = g_object_new (GTK_TYPE_LABEL, pbar->label = g_object_new (GTK_TYPE_LABEL,
"accessible-role", GTK_ACCESSIBLE_ROLE_NONE,
"css-name", "text", "css-name", "text",
"label", text, "label", text,
"ellipsize", pbar->ellipsize, "ellipsize", pbar->ellipsize,