Skip to content

fix(ui): focus the terminal drawer when the panel opens - #342

Merged
Tryanks merged 2 commits into
mainfrom
fix/focus-terminal-on-open
Sep 6, 2026
Merged

Tryanks merged 2 commits into
mainfrom
fix/focus-terminal-on-open

Conversation

@Tryanks

@Tryanks Tryanks commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Changed behaviour

Opening the terminal panel (toolbar button or command palette) now moves keyboard focus into the terminal, so a command can be typed immediately. Previously focus stayed on the composer/palette and the user had to click into the panel first.

Why here

Both entry points route through WorkspaceStore::toggle_terminal_panel, so the chat view (which owns the drawer) watches the store with observe_in and focuses the drawer's FocusHandle on the closed→open transition. No new abstractions; one field tracks the previous open state. Focus is deferred one frame so the drawer is mounted when it takes focus. Closing the panel is untouched, so focus returns via GPUI's normal handling.

Checks run

  • cargo fmt --all --check — ok
  • cargo clippy --workspace --all-targets --locked -- -D warnings — ok
  • cargo test -p tcode-ui --locked — 279 passed
  • Not run locally: full cargo test --workspace, Windows/Linux, mobile/Web builds (CI).

Opening the terminal from the toolbar button or the command palette left
keyboard focus where it was, so typing did nothing until the user clicked
into the panel. The chat view now watches the store for the closed->open
transition and hands focus to the drawer, covering every route that opens
the terminal through the store.
@Tryanks
Tryanks merged commit cbcd00c into main Sep 6, 2026
5 checks passed
@Tryanks
Tryanks deleted the fix/focus-terminal-on-open branch September 6, 2026 16:55
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