From 10fef92eeaa75ac538237380c401269c98974ecb Mon Sep 17 00:00:00 2001 From: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com> Date: Mon, 24 Feb 2025 19:09:46 -0500 Subject: [PATCH] Dismiss git commit modal when it's out of focus (#25518) Release Notes: - Fix git commit modal not being dismissed when pressing esc key or clicking outside the modal --- crates/git_ui/src/commit_modal.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/git_ui/src/commit_modal.rs b/crates/git_ui/src/commit_modal.rs index 8decb4f82d34ec7dca17c31cd853a1ff2fe55e53..4c6c8cdd8452d9909254206559fd3ef8a0b24f8e 100644 --- a/crates/git_ui/src/commit_modal.rs +++ b/crates/git_ui/src/commit_modal.rs @@ -149,6 +149,13 @@ impl CommitModal { } } + let focus_handle = commit_editor.focus_handle(cx); + + cx.on_focus_out(&focus_handle, window, |this, _, window, cx| { + cx.emit(DismissEvent); + }) + .detach(); + Self { git_panel, commit_editor,