summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-10-21 14:55:13 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-10-21 14:55:13 -0400
commitca9b06878d406841e8aa8df3a7da53c653c1276b (patch)
tree359c639789bc4fe9aac90aba0768ba1eacc2a368
parent8f100269ad5f7d236560a2c83db73be4005529bc (diff)
downloadgtk+-ca9b06878d406841e8aa8df3a7da53c653c1276b.tar.gz
switch: Hide internal structure from a11y
According to section 7.1 of WAI-ARIA, the switch role has the "Children presentational" characteristic, which indicates that children should not be represented in the a11y tree.
-rw-r--r--gtk/gtkswitch.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index a178672595..bb681d9123 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -651,13 +651,21 @@ gtk_switch_init (GtkSwitch *self)
gtk_switch_allocate);
gtk_widget_set_layout_manager (GTK_WIDGET (self), layout);
- self->on_image = gtk_image_new_from_icon_name ("switch-on-symbolic");
+ self->on_image = g_object_new (GTK_TYPE_IMAGE,
+ "accessible-role", GTK_ACCESSIBLE_ROLE_NONE,
+ "icon-name", "switch-on-symbolic",
+ NULL);
gtk_widget_set_parent (self->on_image, GTK_WIDGET (self));
- self->off_image = gtk_image_new_from_icon_name ("switch-off-symbolic");
+ self->off_image = g_object_new (GTK_TYPE_IMAGE,
+ "accessible-role", GTK_ACCESSIBLE_ROLE_NONE,
+ "icon-name", "switch-off-symbolic",
+ NULL);
gtk_widget_set_parent (self->off_image, GTK_WIDGET (self));
- self->slider = gtk_gizmo_new ("slider", NULL, NULL, NULL, NULL, NULL, NULL);
+ self->slider = gtk_gizmo_new_with_role ("slider",
+ GTK_ACCESSIBLE_ROLE_NONE,
+ NULL, NULL, NULL, NULL, NULL, NULL);
gtk_widget_set_parent (self->slider, GTK_WIDGET (self));
gtk_accessible_update_state (GTK_ACCESSIBLE (self),