Skip to content

fix(floating-workspace): route tab shortcuts to focused floating panel - #10359

Closed
innocarpe wants to merge 1 commit into
stablyai:mainfrom
innocarpe:fix/floating-workspace-shortcut-routing
Closed

innocarpe wants to merge 1 commit into
stablyai:mainfrom
innocarpe:fix/floating-workspace-shortcut-routing

Conversation

@innocarpe

Copy link
Copy Markdown
Contributor

Summary

Root cause

  1. Digit jumps: Main-process before-input-event always dispatched jumpToWorktreeIndex / jumpToTabIndex and preventDefault’d the key, so the floating panel’s capture handler never saw it. floatingTerminalInputFocused only skipped sidebar toggles and only tracked xterm focus—not tab-bar/chrome focus.
  2. Pane close: Floating panel’s tab.close handler always called closeFloatingItem() (whole tab) with stopImmediatePropagation, so the split-pane close path never ran.

Fix

  • Add ui:setFloatingPanelFocused IPC so main knows when any floating panel focus exists (chrome or terminal).
  • Skip main interception of indexed jumps when floating terminal input or floating panel is focused.
  • Remap workspace.selectByIndex in the floating panel capture handler to activate floating tabs.
  • Defer tab.close to the terminal pane handler when the active floating terminal layout is a split.

Test plan

  • Unit: main skips jumpToWorktreeIndex / jumpToTabIndex when floating terminal input is focused
  • Unit: main skips the same when only floating panel chrome is focused
  • Unit: shouldDeferFloatingWorkspaceTabCloseToPane only true for split terminal + terminal input
  • Existing FloatingTerminalPanel / createMainWindow suites pass
  • pnpm typecheck passes
  • Manual: open floating workspace, 2+ tabs, focus panel → Cmd/Ctrl+1/2 switches floating tabs only
  • Manual: Cmd/Ctrl+D split in floating → Cmd/Ctrl+W closes focused pane only; last pane closes tab

Platform notes

Cross-platform: uses existing keybinding matchers (Cmd on macOS, Ctrl/Alt elsewhere). No platform-specific branching beyond existing shortcut tables.

When the floating workspace is focused, digit tab/workspace jump chords
were still intercepted in the main process and applied to the main
workspace. Mirror full floating-panel focus (not only xterm input) so
main skips jumpToWorktreeIndex/jumpToTabIndex and the panel remaps
workspace.selectByIndex to its own tabs.

Also defer tab.close to the terminal pane handler when a floating
terminal has split panes, so Cmd/Ctrl+W closes only the focused pane.

Closes stablyai#10288
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@innocarpe, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bd599e4d-53a8-4809-bc51-ed24b9d22585

📥 Commits

Reviewing files that changed from the base of the PR and between 1bd36ce and f0d50e0.

📒 Files selected for processing (10)
  • src/main/window/createMainWindow.test.ts
  • src/main/window/createMainWindow.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/floating-terminal/FloatingTerminalPanel.test.tsx
  • src/renderer/src/components/floating-terminal/FloatingTerminalPanel.tsx
  • src/renderer/src/lib/floating-workspace-shortcut-policy.ts
  • src/renderer/src/lib/floating-workspace-terminal-actions.test.ts
  • src/renderer/src/lib/floating-workspace-terminal-actions.ts
  • src/renderer/src/web/web-preload-api.ts

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.

@feelgom

feelgom commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Hey @innocarpe — thanks for picking this up! Looks like we landed on the same fix independently and ended up duplicating effort here. Wanted to flag #10280 so we can consolidate rather than split the work.

Quick context:

The two PRs are essentially the same approach. Both:

  • add a ui:setFloatingPanelFocused IPC channel and skip main-process interception of jumpToWorktreeIndex / jumpToTabIndex when the floating panel (or its terminal input) is focused,
  • remap workspace.selectByIndex in the floating panel's capture handler to switch floating tabs, and
  • defer tab.close to the pane handler when the active floating terminal is a split.

The main-process guard, the preload/web-preload signatures, and the setFloatingPanelFocusedInMain helper are basically identical between them. Your PR additionally factors some of this into floating-workspace-shortcut-policy / floating-workspace-terminal-actions helpers with extra tests, which I think is a nice improvement.

Proposal — happy with whichever keeps us to one PR:

  1. Land fix(floating-workspace): correct shortcut routing for tab switch and pane close #10280 as the base (it's earlier and already reviewed), and I'll fold in your helper refactor + added tests, crediting you via a Co-authored-by: trailer; or
  2. Go with fix(floating-workspace): route tab shortcuts to focused floating panel #10359's structure, but add a Co-authored-by: trailer crediting me so the original work is preserved.

Either way works for me — just want to make sure we don't lose one of the two contributions. What do you prefer? cc @AmethystLiang @nwparker

@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