Skip to content

fix(floating-workspace): correct shortcut routing for tab switch and pane close - #10280

Closed
feelgom wants to merge 4 commits into
stablyai:mainfrom
feelgom:fix/floating-workspace-shortcut-routing
Closed

feelgom wants to merge 4 commits into
stablyai:mainfrom
feelgom:fix/floating-workspace-shortcut-routing

Conversation

@feelgom

@feelgom feelgom commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

What Changed

Main process (createMainWindow.ts): Skip jumpToWorktreeIndex/jumpToTabIndex dispatch when the floating terminal input is focused, allowing the renderer's capture-phase handler to route them correctly.

Floating panel (FloatingTerminalPanel.tsx):

  • Intercept workspace.selectByIndex in the capture handler to switch floating tabs.
  • Defer tab.close to the terminal pane keyboard handler when the active terminal has split panes, so only the focused pane is closed.

Test Plan

  • Floating workspace focused → Cmd+1/2 switches tabs within the floating panel (not main)
  • Floating workspace focused → Ctrl+1/2 switches tabs within the floating panel (not main)
  • Cmd+D to split pane in floating → Cmd+W closes only the focused pane
  • Last pane remaining → Cmd+W closes the tab
  • Single pane (no split) → Cmd+W closes the tab immediately
  • Main workspace shortcuts unaffected when floating panel is closed/unfocused
  • pnpm typecheck passes
  • pnpm lint passes
  • Existing tests pass (no regressions)

Platform Notes

The bug and fix apply equally to all platforms — only the key combinations differ (Cmd on macOS, Ctrl on Windows/Linux). No platform-specific code paths were introduced.

No visual changes.

AI Code Review Summary

  • Cross-platform: Fix uses existing platform-aware keybinding matchers; no hardcoded modifier keys.
  • SSH/Remote: No impact — shortcut routing is purely renderer/main process logic.
  • Agent/Integration: No impact.
  • Performance: Negligible — adds one store lookup (terminalLayoutsByTabId) on Cmd+W in a focused floating terminal.
  • Security: No risk — no new IPC channels or external data handling.

🐦 @feelgom

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 24, 2026 03:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

feelgom and others added 2 commits July 24, 2026 12:18
…ting panel

When the floating workspace panel has focus, Cmd+1/2 and Ctrl+1/2
were incorrectly switching tabs in the main workspace behind the panel.

The main process intercepted these shortcuts and sent IPC to the renderer
without checking floating panel focus state. Now the main process skips
jumpToWorktreeIndex/jumpToTabIndex dispatch when the floating terminal
input is focused, letting the renderer's capture-phase handler route
them to the floating panel's own tab switching logic.

Co-Authored-By: Claude <[email protected]>
…close

Two fixes for the floating workspace shortcut handler:

1. Intercept workspace.selectByIndex (Cmd+1/2 on macOS, Ctrl+1/2 on
   Windows/Linux) in the floating panel's capture handler so it switches
   tabs within the floating workspace instead of being a no-op after the
   main process skip.

2. When the active terminal tab has split panes, defer Cmd+W to the
   terminal pane keyboard handler instead of unconditionally closing
   the entire tab. The pane handler correctly closes only the focused
   pane and falls back to closing the tab when the last pane is removed.

Co-Authored-By: Claude <[email protected]>
@feelgom
feelgom force-pushed the fix/floating-workspace-shortcut-routing branch from 693b0e8 to 41371ad Compare July 24, 2026 03:18
@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Updated shortcut routing for floating panels. Focus is mirrored to the main process and reset across panel, renderer, navigation, and window lifecycle events. Main-process interception now excludes worktree and tab index jumps while floating terminal input or the floating panel is focused, with tests covering Digit1 variants. Floating-panel handling defers tab closure for focused split terminal panes and remaps workspace digit shortcuts to matching visible floating tabs.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the main change: shortcut routing fixes in the floating workspace.
Description check ✅ Passed It includes summary, changed areas, test plan, platform notes, and AI review; only screenshots, security audit, and notes sections are omitted.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6dcf9f4d-0ccd-40d3-b285-b4da4c64cd1a

📥 Commits

Reviewing files that changed from the base of the PR and between 381e81e and 693b0e86c47721ac4451c213820ef68db7a8b5e1.

📒 Files selected for processing (2)
  • src/main/window/createMainWindow.ts
  • src/renderer/src/components/floating-terminal/FloatingTerminalPanel.tsx

Comment thread src/main/window/createMainWindow.ts Resolved
feelgom and others added 2 commits July 24, 2026 12:21
… focused

Add a regression test that confirms jumpToWorktreeIndex and
jumpToTabIndex IPC are not dispatched when the floating terminal input
is focused, ensuring tab/workspace switch shortcuts route to the
floating panel's renderer handler instead.

Co-Authored-By: Claude <[email protected]>
…panel

The previous fix only skipped main-process interception when the floating
terminal xterm input was focused. When the tab bar or panel chrome held
focus, floatingTerminalInputFocused remained false, so Cmd+1/Ctrl+1
were still intercepted and routed to the main workspace.

Add a separate floatingPanelFocused IPC mirror that tracks focus anywhere
inside the floating panel container. The main process now skips
jumpToWorktreeIndex/jumpToTabIndex dispatch when either flag is set.

Co-Authored-By: Claude <[email protected]>
@AmethystLiang

Copy link
Copy Markdown
Contributor

Closing as a duplicate of #10433, which is the maintained fix for #10288 (floating workspace shortcuts routing to the floating panel rather than the main window).

Thanks for the contribution — please track #10433 for the merge.

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.

[Bug]: Floating workspace shortcuts route to main workspace instead of floating panel

4 participants