Skip to content

Focus tab's focused surface on tab bar click#345

Merged
sbertix merged 1 commit into
mainfrom
sbertix/tab-to-surface
May 21, 2026
Merged

Focus tab's focused surface on tab bar click#345
sbertix merged 1 commit into
mainfrom
sbertix/tab-to-surface

Conversation

@sbertix
Copy link
Copy Markdown
Collaborator

@sbertix sbertix commented May 21, 2026

What

Clicking a tab in the tab bar now always gives keyboard focus to that tab's focused surface.

Why

The tab bar's onSelect called TerminalTabManager.selectTab(id), which only updates selectedTabId. It never moved keyboard focus to a surface, so clicking a tab left the previously focused surface (in another tab) as first responder.

How

Route the click through WorktreeTerminalState.selectTab(id) instead. That method already updates the tab manager selection and calls focusSurface(in:), which focuses the tab's last-focused surface (or its first visible surface if none was recorded). Because it always calls focusSurface(in:), clicking the already-selected tab also re-focuses its surface.

No other tab-selection path is affected: the remaining tabManager.selectTab calls are internal to WorktreeTerminalState, and the WorktreeTerminalManager command path already routes through WorktreeTerminalState.selectTab.

Testing

  • make build-app succeeds.
  • make test passes.

Clicking a tab in the tab bar only updated the selected tab id without
moving keyboard focus to a surface. Route the click through
WorktreeTerminalState.selectTab so selecting a tab always focuses that
tab's focused surface (or its first visible surface).
@sbertix sbertix enabled auto-merge (squash) May 21, 2026 22:16
@tuist
Copy link
Copy Markdown

tuist Bot commented May 21, 2026

🛠️ Tuist Run Report 🛠️

Builds 🔨

Scheme Status Duration Commit
supacode 1m 54s 05c4e36bd

@sbertix sbertix merged commit b1b4c4f into main May 21, 2026
2 checks passed
@sbertix sbertix deleted the sbertix/tab-to-surface branch May 21, 2026 22:25
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