[gtk/matthiasc/for-master] switch: Hide internal structure from a11y
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] switch: Hide internal structure from a11y
- Date: Wed, 21 Oct 2020 19:10:51 +0000 (UTC)
commit ca9b06878d406841e8aa8df3a7da53c653c1276b
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Oct 21 14:55:13 2020 -0400
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.
gtk/gtkswitch.c | 14 +++++++++++---
1 file 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),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]