Skip to content

fix(app): focus terminal when panel opens via toggle shortcut#16799

Open
anduimagui wants to merge 3 commits intoanomalyco:devfrom
anduimagui:fix/terminal-focus-on-toggle
Open

fix(app): focus terminal when panel opens via toggle shortcut#16799
anduimagui wants to merge 3 commits intoanomalyco:devfrom
anduimagui:fix/terminal-focus-on-toggle

Conversation

@anduimagui
Copy link

Issue for this PR

Closes #12637

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes a bug where toggling the terminal panel open via keyboard shortcut would not shift focus from the chat input to the terminal when a terminal was already active (e.g., restored from a previous session).

Root Cause: The focus effect in terminal-panel.tsx only triggered when terminal.active() changed value. When the panel was toggled open but the active terminal ID remained the same, no focus shift occurred.

Fix: Added a new effect that watches panel.open() and focuses the active terminal whenever the panel transitions from closed to open, regardless of whether the active terminal changed.

How did you verify your code works?

  • Tested locally by:
    1. Opening a terminal panel
    2. Closing it
    3. Focusing the chat input
    4. Toggling the terminal panel open with the keyboard shortcut
    5. Verifying the terminal now receives focus instead of the input keeping focus

Screenshots / recordings

N/A - focus behavior change

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@anduimagui anduimagui requested a review from adamdotdevin as a code owner March 9, 2026 21:23
The focus effect only triggered when terminal.active() changed, not when
the panel opened. This meant if a terminal was already active (restored
from previous session), toggling the panel open wouldn't shift focus from
the chat input to the terminal.

Added a new effect that watches panel.open() and focuses the active
terminal whenever the panel transitions from closed to open.
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.

(desktop) custom shortcut for toggle terminal doesn't work if terminal is focused

1 participant