[gtk/matthiasc/a11y-logging] a11y: Update GtkToggleButton



commit 19243bb5902c15e59a0ffa3577298311319b5a92
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 17 13:53:38 2020 -0400

    a11y: Update GtkToggleButton
    
    Looking at the aria spec, toggle button should probably
    also fall under the checkbox role. And the description
    of those roles' required attributes indicate that we
    should use the checked state, not the pressed state,
    for the :active property. The aria pressed state more
    closely resembled our GTK_STATE_FLAGS_ACTIVE widget
    state, which is unfortunately set in a place where
    we cannot easily update accessible state.

 gtk/gtktogglebutton.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index c9c55b98d2..18b9ddb000 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -181,6 +181,7 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class)
                  G_TYPE_NONE, 0);
 
   gtk_widget_class_set_css_name (widget_class, I_("button"));
+  gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_CHECKBOX);
 }
 
 static void
@@ -314,7 +315,7 @@ gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
     gtk_widget_unset_state_flags (GTK_WIDGET (toggle_button), GTK_STATE_FLAG_CHECKED);
 
   gtk_accessible_update_state (GTK_ACCESSIBLE (toggle_button),
-                               GTK_ACCESSIBLE_STATE_PRESSED, is_active,
+                               GTK_ACCESSIBLE_STATE_CHECKED, is_active,
                                -1);
 
   gtk_toggle_button_toggled (toggle_button);


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