mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
a11y: Ensure the focus lands on the correct element during cascaded popover popdown
Previously it ended on the immediate parent of the lowest level popover, which was not good, as it very likely was some even already hidden widget, or at least, the a11y machinery thought so.
This commit is contained in:
parent
6c88713f82
commit
2299c02639
@ -2370,17 +2370,20 @@ static void
|
||||
cascade_popdown (GtkPopover *popover)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
GtkWidget *new_focus;
|
||||
|
||||
/* Do not trigger cascade close from non-modal popovers */
|
||||
if (!gtk_popover_get_autohide (popover))
|
||||
return;
|
||||
|
||||
parent = gtk_widget_get_parent (GTK_WIDGET (popover));
|
||||
new_focus = parent;;
|
||||
|
||||
while (parent)
|
||||
{
|
||||
if (GTK_IS_POPOVER (parent))
|
||||
{
|
||||
new_focus = gtk_widget_get_parent (parent);
|
||||
if (gtk_popover_get_cascade_popdown (GTK_POPOVER (parent)))
|
||||
gtk_widget_set_visible (parent, FALSE);
|
||||
else
|
||||
@ -2389,6 +2392,7 @@ cascade_popdown (GtkPopover *popover)
|
||||
|
||||
parent = gtk_widget_get_parent (parent);
|
||||
}
|
||||
gtk_widget_grab_focus (new_focus);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user