mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
Merge branch 'submenu_reporting' into 'main'
a11y: When a menu item opens a submenu, set its expandable state See merge request GNOME/gtk!5850
This commit is contained in:
commit
e00722dee6
@ -560,12 +560,21 @@ static void
|
||||
update_accessible_properties (GtkModelButton *button)
|
||||
{
|
||||
if (button->menu_name || button->popover)
|
||||
{
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (button),
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED, FALSE,
|
||||
-1);
|
||||
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
|
||||
GTK_ACCESSIBLE_PROPERTY_HAS_POPUP, TRUE,
|
||||
-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_accessible_reset_property (GTK_ACCESSIBLE (button),
|
||||
GTK_ACCESSIBLE_PROPERTY_HAS_POPUP);
|
||||
gtk_accessible_reset_state (GTK_ACCESSIBLE (button),
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED);
|
||||
}
|
||||
|
||||
if (button->popover)
|
||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
||||
@ -1057,7 +1066,12 @@ switch_menu (GtkModelButton *button)
|
||||
|
||||
stack = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK);
|
||||
if (stack != 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);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1077,6 +1091,10 @@ gtk_model_button_clicked (GtkModelButton *self)
|
||||
gtk_popover_popup (GTK_POPOVER (submenu));
|
||||
gtk_popover_menu_set_open_submenu (menu, submenu);
|
||||
gtk_popover_menu_set_parent_menu (GTK_POPOVER_MENU (submenu), GTK_WIDGET (menu));
|
||||
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED, TRUE,
|
||||
-1);
|
||||
}
|
||||
else if (!self->keep_open)
|
||||
{
|
||||
@ -1085,6 +1103,10 @@ gtk_model_button_clicked (GtkModelButton *self)
|
||||
popover = gtk_widget_get_ancestor (GTK_WIDGET (self), GTK_TYPE_POPOVER);
|
||||
if (popover)
|
||||
gtk_popover_popdown (GTK_POPOVER (popover));
|
||||
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED, FALSE,
|
||||
-1);
|
||||
}
|
||||
|
||||
if (self->action_helper)
|
||||
|
Loading…
Reference in New Issue
Block a user