fix(palette): keep Tab inside the command palette

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.
This commit is contained in:
l0ng-ai
2026-08-08 15:57:21 +07:00
parent 8286317493
commit 4eebd2cd34
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -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)));
+1
View File
@@ -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) {