Skip to content

fix(web-ui): keep tab shortcuts scoped to the focused region - #3774

Merged
bobleer merged 4 commits into
GCWing:mainfrom
bobleer:bob/fix-focused-tab-shortcuts
Nov 6, 2026
Merged

bobleer merged 4 commits into
GCWing:mainfrom
bobleer:bob/fix-focused-tab-shortcuts

Conversation

@bobleer

@bobleer bobleer commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Ctrl+W on Windows/Linux and Cmd+W on macOS now close the tab in the region the user is operating. The conversation area closes its scene tab; the file/terminal area closes its own active tab, including split groups and a separate bottom terminal canvas.

Type and Areas

Type: bug fix / keyboard interaction

Areas: Web UI, shared desktop frontend, shortcut registration, documentation

Motivation / Impact

Previously, the top-level conversation had no close binding, nested terminal focus did not reach the canvas handler, and independently mounted canvases could replace each other's registrations. The third split also resolved to the second group.

  • Keep mounted shortcut owners independent while preserving the existing tab.close customization ID.
  • Resolve close ownership from the focused surface/group, with remembered workbench focus after a removed tab releases DOM focus. Empty content panes never close another pane's conversation.
  • Reuse scene/canvas close guards for unsaved files, settings drafts, temporary conversations and terminal cleanup. Ignore held-key repeats, IME-owned events and overlays, and deduplicate pending keyboard closes.
  • Keep normal terminal commands scoped; only explicitly opted-in parent commands cross nested scopes.
  • Keep numbered tab selection, reopening, editor find and canvas layout commands with their owning canvas, including when another canvas unmounts. Resolve numbered selection from the focused split group.
  • Focus the recorder before capturing custom bindings, and capture before existing commands/native fallbacks execute. Scope recording to the settings section, ignore IME/repeated events, and retain global conflict checks when a command also has scoped handlers. Preserve physical Control as an additional macOS modifier instead of matching Ctrl+Cmd+W as Cmd+W.

Verification

  • pnpm --dir src/web-ui run test:run src/app/hooks/useTabCloseShortcut.test.tsx src/infrastructure/services/ShortcutManager.test.ts src/app/components/panels/content-canvas/hooks/useTabLifecycle.btw.test.tsx src/app/stores/sceneStore.test.ts src/app/services/sessionSceneLifecycle.test.ts src/flow_chat/services/sessionActivation.test.ts src/flow_chat/services/storeSync.test.ts src/app/workbench/WorkbenchLayout.test.tsx src/app/workbench/workbenchContent.test.ts src/app/scenes/settings/pages/application/KeyboardShortcutsSection.test.tsx src/app/scenes/settings/pages/application/KeyboardShortcutsSection.presentation.test.ts src/app/browserShortcutPolicy.test.ts src/app/global-search/globalSearchShortcut.test.ts src/app/hooks/windowFullscreenShortcut.test.ts src/app/components/panels/content-canvas/hooks/canvasPanelOwnership.test.tsx src/app/components/SceneBar/SceneBar.test.tsx src/app/components/panels/content-canvas/editor-area/EditorArea.test.tsx — 282 tests passed across 17 files.
  • pnpm run check:web — passed appearance, typography, theme and TypeScript checks.
  • pnpm --dir src/web-ui exec tsc --noEmit — passed after the final changes.
  • git diff --check — passed.

Reviewer Notes

AI-assisted implementation and review; locally tested with real shortcut dispatch and store/lifecycle fixtures. The keyboard tests simulate Windows/Linux/macOS modifiers, concurrent panes, terminal lifecycle, existing custom bindings and cancellation after a Peer surface switch. Native OS/WebView keyboard delivery and live SSH, Remote Control, Peer Device and Detached Dispatch scenarios have not been manually exercised. There is no visual layout change; interaction regressions are covered by DOM tests.

The four commits separate shortcut-registration support, focused tab-close behavior, related navigation/recording fixes, and recorder focus/conflict checks found during review. Regression tests reproduced the related failures before the fixes. No persisted format, remote protocol or runtime/session ownership changes are introduced.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@bobleer bobleer changed the title fix(web-ui): close tabs in the focused workbench region fix(web-ui): keep tab shortcuts scoped to the focused region Nov 6, 2026
@bobleer
bobleer merged commit a327a3f into GCWing:main Nov 6, 2026
9 checks passed
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