mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
a11y: When a menu item opens a submenu, set its expandable state
To help distinguish submenu opening items, mark them as expandable. Previously, they only indicated that they had a popup, which is too general.
This commit is contained in:
parent
40ac37245d
commit
afbcbb8404
@ -560,12 +560,21 @@ static void
|
|||||||
update_accessible_properties (GtkModelButton *button)
|
update_accessible_properties (GtkModelButton *button)
|
||||||
{
|
{
|
||||||
if (button->menu_name || button->popover)
|
if (button->menu_name || button->popover)
|
||||||
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
|
{
|
||||||
GTK_ACCESSIBLE_PROPERTY_HAS_POPUP, TRUE,
|
gtk_accessible_update_state (GTK_ACCESSIBLE (button),
|
||||||
-1);
|
GTK_ACCESSIBLE_STATE_EXPANDED, FALSE,
|
||||||
|
-1);
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_HAS_POPUP, TRUE,
|
||||||
|
-1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
gtk_accessible_reset_property (GTK_ACCESSIBLE (button),
|
{
|
||||||
GTK_ACCESSIBLE_PROPERTY_HAS_POPUP);
|
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)
|
if (button->popover)
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
||||||
@ -1043,7 +1052,12 @@ switch_menu (GtkModelButton *button)
|
|||||||
|
|
||||||
stack = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK);
|
stack = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK);
|
||||||
if (stack != NULL)
|
if (stack != NULL)
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (stack), button->menu_name);
|
{
|
||||||
|
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
|
static void
|
||||||
@ -1063,6 +1077,10 @@ gtk_model_button_clicked (GtkModelButton *self)
|
|||||||
gtk_popover_popup (GTK_POPOVER (submenu));
|
gtk_popover_popup (GTK_POPOVER (submenu));
|
||||||
gtk_popover_menu_set_open_submenu (menu, submenu);
|
gtk_popover_menu_set_open_submenu (menu, submenu);
|
||||||
gtk_popover_menu_set_parent_menu (GTK_POPOVER_MENU (submenu), GTK_WIDGET (menu));
|
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)
|
else if (!self->keep_open)
|
||||||
{
|
{
|
||||||
@ -1071,6 +1089,10 @@ gtk_model_button_clicked (GtkModelButton *self)
|
|||||||
popover = gtk_widget_get_ancestor (GTK_WIDGET (self), GTK_TYPE_POPOVER);
|
popover = gtk_widget_get_ancestor (GTK_WIDGET (self), GTK_TYPE_POPOVER);
|
||||||
if (popover)
|
if (popover)
|
||||||
gtk_popover_popdown (GTK_POPOVER (popover));
|
gtk_popover_popdown (GTK_POPOVER (popover));
|
||||||
|
|
||||||
|
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
|
||||||
|
GTK_ACCESSIBLE_STATE_EXPANDED, FALSE,
|
||||||
|
-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->action_helper)
|
if (self->action_helper)
|
||||||
|
Loading…
Reference in New Issue
Block a user