fix(ui): focus the terminal drawer when the panel opens - #342
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 withobserve_inand focuses the drawer'sFocusHandleon 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— okcargo clippy --workspace --all-targets --locked -- -D warnings— okcargo test -p tcode-ui --locked— 279 passedcargo test --workspace, Windows/Linux, mobile/Web builds (CI).