From 9213a4fbe41d3444a0830a211cf46b75f43858f1 Mon Sep 17 00:00:00 2001 From: Hari Rana Date: Fri, 29 Aug 2025 21:21:58 -0600 Subject: [PATCH] gui/window: Only set focus when popover is explicitly closed The window would either set focus to the event widget or a focusable ancestor, no matter how the event popover was being closed. This caused a major accessibility regression where, whenever the event editor dialog opened from the event popover, the window set focus to the event widget instead of the content inside the dialog, which made the dialog incapable of navigating through until the dialog was focused. This also prevented mnemonics from being triggered. This patch addresses that bug by only setting focus whenever the popover is being closed explicitly; as in, when the user presses outside the popover to hide it or pressing escape. Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1398 --- src/gui/gcal-window.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gui/gcal-window.c b/src/gui/gcal-window.c index 1b200582..39c60698 100644 --- a/src/gui/gcal-window.c +++ b/src/gui/gcal-window.c @@ -862,14 +862,13 @@ event_preview_cb (GcalEventWidget *event_widget, case GCAL_EVENT_PREVIEW_ACTION_NONE: default: + if (self->last_focused_widget) + { + gtk_root_set_focus (GTK_ROOT (self), self->last_focused_widget); + g_clear_weak_pointer (&self->last_focused_widget); + } break; } - - if (self->last_focused_widget) - { - gtk_root_set_focus (GTK_ROOT (self), self->last_focused_widget); - g_clear_weak_pointer (&self->last_focused_widget); - } } static void