Skip to content

feat(workspaces): context menu on tabs to duplicate and close all other tabs #7053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: gagik/context-menu-compass-ui
Choose a base branch
from

Conversation

kraenhansen
Copy link
Contributor

@kraenhansen kraenhansen commented Jun 25, 2025

Description

Merging this PR will:

  • Add two new context menu actions to workspace tabs:
    • duplicate, which will create and activate a tab to the right of the tab
    • close all other tabs, which will ... you've guessed it
tabs-context-menu.mov

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

I feel the tooltip is getting in the way of this interaction and while we could solve this in a bespoke way (ex disabling the tooltip component if the context menu isOpen), we could disable the underlying UI (using ex the pointer-events CSS property) when the menu is in its opened state.

Screenshot 2025-06-25 at 15 51 59

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@github-actions github-actions bot added the feat label Jun 25, 2025
@kraenhansen kraenhansen changed the base branch from main to gagik/context-menu-compass-ui June 25, 2025 13:52
@kraenhansen kraenhansen self-assigned this Jun 27, 2025
dispatch({ type: WorkspacesActions.CloseTab, atIndex });
cleanupLocalAppRegistryForTab(tab?.id);
dispatch({ type: WorkspacesActions.CloseAllOtherTabs, atIndex });
cleanupLocalAppRegistryForTab(tabs[atIndex].id);
Copy link
Collaborator

Choose a reason for hiding this comment

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

You want to cleanup for tabs that you closed, not for the only one that stays open. We usually do this through cleanupRemovedTabs method used in similar cases in this slice

const { tabs } = getState();
const otherTabs = tabs.filter((_, index) => index !== atIndex);
for (const tab of otherTabs) {
if (!canCloseTab(tab) && !(await confirmClosingTabs())) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't feel right that canceling close for one tab stops all the others from closing too (or the other way around, you say "yes" for one, then "no" for other, and all stay open), in vscode you'd be asked for evey one separately and they are closed based on your answers. Wouldn't that make more sense for our flow too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants