Skip to content

fix(palette): host the command palette on gpui-base Dialog - #569

Merged
Tryanks merged 1 commit into
mainfrom
fix/palette-on-dialog
Oct 1, 2026
Merged

Tryanks merged 1 commit into
mainfrom
fix/palette-on-dialog

Conversation

@Tryanks

@Tryanks Tryanks commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Changed behaviour

CommandPalette rendered its own modal: a full-viewport overlay that tracked focus, matched escape/up/down by key name, dismissed on an outside press through its own handler, and had no focus trap. It now renders a gpui_base::Dialog with the scrim as backdrop and the card as popup. The dialog owns the host, the focus trap, Escape (Cancel) and the backdrop press; request_close closes the palette and arms the OutsideDismissal release guard the shell mounts, as #565 set up for sheets. The card keeps the palette's own focus handle and the list keys (up/down), so they work from the host focus and from the query input alike; Enter stays with the query input (on_ok returns false). The host is laid out through Dialog's Styled the way the overlay was (bottom sheet on compact, 96px below the top inset on desktop).

Per Principle 7 (#564).

Tests

  • New escape_from_the_query_and_a_backdrop_press_close_the_palette: Escape pressed while the query input is focused closes the palette (the base input binds escape in its own context, so this checks it propagates through to the dialog), and a backdrop press closes it. The palette test harness now renders the palette while the window state says it is open.
  • shell::tests::compact_palette_is_reachable_from_threads_and_thread (existing) covers the compact sheet geometry, backdrop press, Back handling and focus.
  • empty_query_lists_commands_and_arrow_keys_keep_query_focus (existing) covers the list keys.

Checks run

  • cargo fmt --all --check, cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo nextest run -p tcode-ui --locked — all passed

Not verified visually (no Accessibility/Screen Recording permission for the computer-use tools on this machine). Geometry is asserted by the shell test for the compact sheet; the desktop placement is the same inset arithmetic as before.

The palette rebuilt a modal by hand: a viewport overlay carrying its own
focus, Escape handling and outside-press dismissal, with no focus trap.
gpui_base::Dialog now owns the host, the focus trap, Escape and the
backdrop press; the palette keeps its card, the list keys and the
release guard, armed from the dialog's close request.
@Tryanks
Tryanks merged commit 08025c4 into main Oct 1, 2026
7 checks passed
@Tryanks
Tryanks deleted the fix/palette-on-dialog branch October 1, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant