mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
a11y: Set expanded states properly when switching to a submenu
This commit is contained in:
parent
166afbf8e8
commit
345eca1efe
@ -1067,10 +1067,29 @@ switch_menu (GtkModelButton *button)
|
||||
stack = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK);
|
||||
if (stack != NULL)
|
||||
{
|
||||
if (button->role == GTK_BUTTON_ROLE_NORMAL)
|
||||
{
|
||||
GtkWidget *title_button = gtk_widget_get_first_child (gtk_stack_get_child_by_name (GTK_STACK (stack), button->menu_name));
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (button),
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED, TRUE,
|
||||
-1);
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (title_button),
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED, TRUE,
|
||||
-1);
|
||||
g_object_set_data (G_OBJECT (title_button), "-gtk-model-button-parent", button);
|
||||
}
|
||||
else if (button->role == GTK_BUTTON_ROLE_TITLE)
|
||||
{
|
||||
GtkWidget *parent_button = g_object_get_data (G_OBJECT (button), "-gtk-model-button-parent");
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (parent_button),
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED, FALSE,
|
||||
-1);
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (button),
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED, FALSE,
|
||||
-1);
|
||||
g_object_set_data (G_OBJECT (button), "-gtk-model-button-parent", NULL);
|
||||
}
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (stack), button->menu_name);
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (button),
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED, TRUE,
|
||||
-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user