From d662811bf6d004382061380f537ffdeb0bffe892 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Wed, 16 Jul 2025 14:36:58 +0300 Subject: Unfocus layout when exit confirm dialog is open Screen readers expect closing a modal dialog to reannounce the previous focus. This makes the exit confirm dialog more modal in this sense: it will unfocus the layout and then focus it back when closed, giving the desired behavior. --- src/handlers/xdg_shell.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/handlers') diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index a9eceb67..b7123e5f 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -303,7 +303,11 @@ impl XdgShellHandler for State { // We need to hand out the grab in a way consistent with what update_keyboard_focus() // thinks the current focus is, otherwise it will desync and cause weird issues with // keyboard focus being at the wrong place. - if self.niri.is_locked() { + if self.niri.exit_confirm_dialog.is_open() { + trace!("ignoring popup grab because the exit confirm dialog is open"); + let _ = PopupManager::dismiss_popup(&root, &popup); + return; + } else if self.niri.is_locked() { if Some(&root) != self.niri.lock_surface_focus().as_ref() { trace!("ignoring popup grab because the session is locked"); let _ = PopupManager::dismiss_popup(&root, &popup); -- cgit