[gtk/a11y/stackswitcher-tabs: 3/5] stackswitcher: Use the tablist and tab roles




commit 359881df8a353d02f1a5211fa39e6240aaf49c46
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Oct 14 00:18:02 2020 -0400

    stackswitcher: Use the tablist and tab roles
    
    Set the tablist role on the stackswitcher itself, and
    the tab role on the buttons. This is another step towards
    implementing the tabs pattern for GtkStack.

 gtk/gtkstackswitcher.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkstackswitcher.c b/gtk/gtkstackswitcher.c
index f9316f9a4d..e9cbfc9b90 100644
--- a/gtk/gtkstackswitcher.c
+++ b/gtk/gtkstackswitcher.c
@@ -248,7 +248,9 @@ add_child (guint             position,
   GtkStackPage *page;
   GtkEventController *controller;
 
-  button = gtk_toggle_button_new ();
+  button = g_object_new (GTK_TYPE_TOGGLE_BUTTON,
+                         "accessible-role", GTK_ACCESSIBLE_ROLE_TAB,
+                         NULL);
   gtk_widget_set_focus_on_click (button, FALSE);
 
   controller = gtk_drop_controller_motion_new ();
@@ -498,6 +500,7 @@ gtk_stack_switcher_class_init (GtkStackSwitcherClass *class)
 
   gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
   gtk_widget_class_set_css_name (widget_class, I_("stackswitcher"));
+  gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_TAB_LIST);
 }
 
 /**


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