Skip to content

refactor(workspace): polish tab context menu#29

Draft
nianshou555qiansui wants to merge 1 commit into
ohmygit-hub:mainfrom
nianshou555qiansui:feat/tab-context-menu-polish
Draft

refactor(workspace): polish tab context menu#29
nianshou555qiansui wants to merge 1 commit into
ohmygit-hub:mainfrom
nianshou555qiansui:feat/tab-context-menu-polish

Conversation

@nianshou555qiansui

Copy link
Copy Markdown
Contributor

What

Follow-up to #26 addressing the review nits plus a right-click bug I hit while using the feature.

  • Right-click no longer switches tabs. Right-clicking a background tab now only opens the context menu; it no longer activates that tab (matches Chrome/VS Code). Done by preventing the default focus on right mousedown so reka-ui's TabsTrigger @focus auto-activation doesn't fire.
  • Batch closes preserve the surviving tab's history. closeOtherTabs / closeTabsToRight previously wiped both nav stacks entirely, dropping the kept tab's back/forward history too. They now use a new removeSnapshotTabs helper that strips only the closed tabs from the stacks (mirroring how single-tab closeTab uses removeSnapshotTab).
  • "Close all" is disabled on the no-op case. Added a canCloseAllTabs guard so the item is disabled when the workspace is already just the default /inbox tab, and closeAllTabs early-returns in that case.
  • Distinct icon for "Close all". Switched from a third X to Trash2 so it scans apart from the other close actions.

Why

These are the three nits from the #26 review (kept-tab history reset, close-all no-op guard, icon variety) plus the right-click-activates-tab behavior, which felt wrong in daily use.

Testing

  • pnpm --filter @oh-my-github/client typecheck passes
  • Locales compile test passes
  • Manually verified in the running dev app: right-click keeps the current tab; "Close all" disabled only on the lone default tab and enabled otherwise with the trash icon; closing tabs to the right preserves the surviving tab's back-history

Note: the full client test suite was not run; verification covered typecheck, the locales test, and manual testing.

- Right-clicking a tab no longer switches to it (prevent focus-driven
  activation on the tab trigger); the context menu still opens.
- Batch closes (close others / close to the right) now preserve the
  surviving tabs' navigation history instead of wiping both stacks,
  mirroring single-tab close (removeSnapshotTabs).
- 'Close all' is disabled when the workspace is already just the default
  inbox tab, avoiding a redundant no-op.
- 'Close all' uses a distinct trash icon to stand out from the other items.

Follow-up to ohmygit-hub#26 addressing review nits.

@AidenNovak AidenNovak 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.

The “Close tabs to the right” path is still clearing navigation history.

The PR description says both closeOtherTabs and closeTabsToRight now preserve the surviving tab's history, but the diff only changes closeOtherTabs. closeTabsToRight still sets backStack.value and forwardStack.value to empty arrays.

I reproduced this from the production Electron build at commit ecff9dc. I opened Inbox and Needs Review, switched between them so Back was enabled, kept Needs Review active, then right-clicked Inbox and chose “Close tabs to the right.” Inbox was left open, but both Back and Forward became disabled.

The build, typecheck, and existing test suite all pass (68 files, 459 tests), so the current tests do not cover this interaction.

Could you update closeTabsToRight so it removes only the closed tab URLs from the navigation stacks, and add a regression test for this flow?

Before closing:

Two tabs before closing tabs to the right

Context menu on the background Inbox tab:

Context menu on background Inbox tab

After closing tabs to the right:

Inbox remains with Back and Forward disabled

@nianshou555qiansui nianshou555qiansui marked this pull request as draft July 13, 2026 18:41
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.

2 participants