Skip to content

Only swap Alt-hold close action for the hovered tab in MultiEditorTabsControl - #331772

Merged
Benjamin Christopher Simmonds (benibenj) merged 2 commits into
mainfrom
copilot/update-close-action-on-hover
Aug 21, 2026
Merged

Only swap Alt-hold close action for the hovered tab in MultiEditorTabsControl#331772
Benjamin Christopher Simmonds (benibenj) merged 2 commits into
mainfrom
copilot/update-close-action-on-hover

Conversation

Copilot AI commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Holding Alt in MultiEditorTabsControl swapped the per-tab close action into "Close Others" for every tab in the group at once, which is visually noisy since only one tab can actually be clicked.

Changes

  • Hover-aware state: replaced the control-wide wantsCloseOthersAction: boolean with hoveredTabIndex: number | undefined, tracking which single tab the mouse is currently over.
  • Hover tracking: added mouseenter/mouseleave listeners on each tab (in registerTabListeners) that update hoveredTabIndex via a new setHoveredTab() method.
  • Swap condition: redrawTabAction() now swaps Close → Close Others only when altKey is held and the tab being redrawn matches hoveredTabIndex. Unpin behavior is unaffected.
  • Targeted redraws: Alt press/release and hover changes now redraw only the affected tab(s) (previous + new hovered tab) instead of iterating over all tabs via forEachTab.
  • Stale state cleanup: hover is cleared when the mouse leaves the tabs container, and when the tab count shrinks below the hovered index after closing tabs (handleClosedEditors), preventing a tab from getting stuck showing "Close Others".
// Before: applies to all tabs
const wantsCloseOthersAction = hasCloseAction && this.wantsCloseOthersAction;

// After: only the hovered tab
const wantsCloseOthersAction = hasCloseAction && modifierKeyEmitter.keyStatus.altKey && tabIndex === this.hoveredTabIndex;

Copilot AI balanced review requested due to automatic review settings August 20, 2026 10:06

Copilot AI 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.

Copilot wasn't able to review any files in this pull request.

Co-authored-by: benibenj <44439583+benibenj@users.noreply.github.com>
Copilot AI changed the title [WIP] Update close action to only change for hovered tab Only swap Alt-hold close action for the hovered tab in MultiEditorTabsControl Aug 20, 2026
@benibenj
Benjamin Christopher Simmonds (benibenj) merged commit ec8a43f into main Aug 21, 2026
27 checks passed
@benibenj
Benjamin Christopher Simmonds (benibenj) deleted the copilot/update-close-action-on-hover branch August 21, 2026 02:33
@vs-code-engineering vs-code-engineering Bot added this to the 1.135.0 milestone Aug 21, 2026
Abdon Morales (abdonmorales) pushed a commit to abdonmorales/vscode-utcs that referenced this pull request Aug 22, 2026
…sControl (microsoft#331772)

* Initial plan

* Only swap Alt-hold close action for the hovered tab

Co-authored-by: benibenj <44439583+benibenj@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: benibenj <44439583+benibenj@users.noreply.github.com>
(cherry picked from commit ec8a43f)
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.

5 participants