You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/09/24 18:06:27 UTC
(maka) 14/17: fix(desktop): return focus to the composer after answering a card
This is an automated email from the ASF dual-hosted git repository.
Astro-Han pushed a commit to branch feat/desktop-gpui-spike
in repository https://gitbox.apache.org/repos/asf/maka.git
commit 9f3d1fb6b7027dae8a515a704d2eb79d53c2266f
Author: AstroHan <le...@outlook.com>
AuthorDate: Fri Sep 25 02:00:10 2026 +0800
fix(desktop): return focus to the composer after answering a card
The permission card takes focus when it appears so Enter answers it.
Once answered the card leaves the tree and focus went with it, so the
next keystroke went nowhere. When a card disappears while focus was on
it, or on nothing, give focus back to the composer; if the reader moved
focus elsewhere in the meantime, leave it there.
Generated-by: Claude Code
---
crates/desktop/src/chat/permission.rs | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/crates/desktop/src/chat/permission.rs b/crates/desktop/src/chat/permission.rs
index d601acecbc..2d17d00287 100644
--- a/crates/desktop/src/chat/permission.rs
+++ b/crates/desktop/src/chat/permission.rs
@@ -39,13 +39,22 @@ impl Chat {
window: &mut Window,
cx: &mut Context<Self>,
) -> Option<AnyElement> {
- let pending = self
+ let Some(pending) = self
.snapshot
- .as_ref()?
- .interactions
- .pending()
- .first()?
- .clone();
+ .as_ref()
+ .and_then(|snapshot| snapshot.interactions.pending().first())
+ .cloned()
+ else {
+ // The answered card took its focus with it; hand it to the
+ // composer unless the reader has since moved it elsewhere.
+ if self.focused_interaction.take().is_some()
+ && (window.focused(cx).is_none() || self.permission_focus.is_focused(window))
+ {
+ let handle = self.composer.read(cx).focus_handle(cx);
+ window.on_next_frame(move |window, cx| window.focus(&handle, cx));
+ }
+ return None;
+ };
let id = pending.interaction_id().to_owned();
if self.focused_interaction.as_deref() != Some(id.as_str()) {
self.focused_interaction = Some(id.clone());
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org