Skip to content

Make the unsaved count badge in Open Editors open the first unsaved editor - #329609

Open
Benjamin Christopher Simmonds (benibenj) with Copilot wants to merge 3 commits into
mainfrom
copilot/feature-missing-tab-for-unsaved-editors
Open

Make the unsaved count badge in Open Editors open the first unsaved editor#329609
Benjamin Christopher Simmonds (benibenj) with Copilot wants to merge 3 commits into
mainfrom
copilot/feature-missing-tab-for-unsaved-editors

Conversation

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Description

When an editor with unsaved changes is not reachable from the tab bar, there is no quick way to get back to it. The Open Editors header already shows a "N unsaved" badge, but it was purely decorative.

This makes the badge an activatable shortcut to the first unsaved editor in index order (the first dirty editor of the first group that has one).

openEditorsView.ts

  • New exported helper findFirstDirtyEditor(groups) — a pure function so the lookup can be unit tested.
  • Badge is now tabIndex = 0 / role="button" with a managed hover ("Open Unsaved Editor") via IHoverService, and handlers for CLICK, Tap and Enter/Space.
  • updateDirtyIndicator sets an aria label ("{0} unsaved, open unsaved editor") so screen readers keep the count and learn the action.
  • Uses GroupsOrder.GRID_APPEARANCE, matching what getElements() already uses to build the list.

openeditors.css

  • Pointer cursor and a :focus-visible outline using --vscode-focusBorder.

openEditorsView.test.ts

  • Two tests for findFirstDirtyEditor.

Notes for reviewers

All activation handlers call EventHelper.stop(e, true)Pane toggles the pane's expanded state on header click and on Enter/Space, so without this the pane collapses when the badge is activated:

this._register(Gesture.addTarget(this.dirtyCountElement));
for (const eventType of [dom.EventType.CLICK, TouchEventType.Tap]) {
	this._register(dom.addDisposableListener(this.dirtyCountElement, eventType, e => {
		dom.EventHelper.stop(e, true); // prevent the pane from toggling its expanded state
		this.openFirstDirtyEditor();
	}));
}

Tap is handled separately (mirroring BaseActionViewItem) because Gesture suppresses the synthesized click on touch devices, so a CLICK-only handler would never fire and the tap would collapse the pane instead.

One known gap left as-is: the badge counts dirty working copies, so a dirty working copy with no open editor (e.g. a single-file refactor with files.refactoring.autoSave: false) makes the click a no-op. That count/list mismatch pre-dates this change; gating the affordance dynamically would need extra listeners and risks the badge going silently non-interactive. Happy to revisit if reviewers disagree.

Copilot AI balanced review requested due to automatic review settings August 7, 2026 15:27

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.

Copilot AI and others added 2 commits August 7, 2026 15:47
…ditor

Co-authored-by: benibenj <44439583+benibenj@users.noreply.github.com>
Co-authored-by: benibenj <44439583+benibenj@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing tab for unsaved editors in VS Code Make the unsaved count badge in Open Editors open the first unsaved editor Aug 7, 2026
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.

Missing Tab for unsaved editors

3 participants