From 4eebd2cd34728b9f7121ca9df4e571cf4bedfaa8 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sat, 8 Aug 2026 15:14:25 +0700 Subject: [PATCH] fix(palette): keep Tab inside the command palette MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The palette is walked with the arrows and run with Enter; Tab has no job there. Root's focus walker had one for it anyway, and sent it out of the modal onto whichever chrome tile sat behind the scrim — the New Tab plus, the panel toggle — which lit up with a focus ring the palette had no way to take back. Tab and Shift-Tab bind to `NoAction` in the palette's own context, which is deeper than Root's and stops the search before the walker is reached. --- src/ui/keymap.rs | 5 +++++ src/ui/palette.rs | 1 + 2 files changed, 6 insertions(+) diff --git a/src/ui/keymap.rs b/src/ui/keymap.rs index c2b806bf..3547e302 100644 --- a/src/ui/keymap.rs +++ b/src/ui/keymap.rs @@ -33,6 +33,11 @@ pub fn init(cx: &mut App) { SwitcherAcrossBack, Some("Switcher"), )); + // The palette has nowhere for Tab to go — the arrows walk the list and + // Enter runs it — but Root's focus walker still had somewhere to send it: + // out of the modal, onto whichever chrome tile is behind it, ring and all. + bindings.push(KeyBinding::new("tab", NoAction {}, Some("Palette"))); + bindings.push(KeyBinding::new("shift-tab", NoAction {}, Some("Palette"))); cx.bind_keys(bindings); cx.set_global(BoundKeystrokes(bound_keystrokes(&effective))); diff --git a/src/ui/palette.rs b/src/ui/palette.rs index 5b7a9274..9dbfd769 100644 --- a/src/ui/palette.rs +++ b/src/ui/palette.rs @@ -1137,6 +1137,7 @@ impl Render for PaletteView { .justify_center() .pt(px(120.)) .bg(scrim) + .key_context("Palette") .on_key_down(cx.listener(|this, ev: &gpui::KeyDownEvent, _window, cx| { let ks = &ev.keystroke; if is_edit_gesture(ks) {