Skip to content

Commit a7b227e

Browse files
authored
fix window title issue (microsoft#242252)
fix microsoft#242248
1 parent 68d736a commit a7b227e

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

src/vs/workbench/browser/parts/titlebar/commandCenterControl.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { IQuickInputService } from '../../../../platform/quickinput/common/quick
2222
import { WindowTitle } from './windowTitle.js';
2323
import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.js';
2424
import { IHoverService } from '../../../../platform/hover/browser/hover.js';
25-
import { IAccessibilityService } from '../../../../platform/accessibility/common/accessibility.js';
2625

2726
export class CommandCenterControl {
2827

@@ -87,7 +86,6 @@ class CommandCenterCenterViewItem extends BaseActionViewItem {
8786
@IKeybindingService private _keybindingService: IKeybindingService,
8887
@IInstantiationService private _instaService: IInstantiationService,
8988
@IEditorGroupsService private _editorGroupService: IEditorGroupsService,
90-
@IAccessibilityService private readonly _accessibilityService: IAccessibilityService
9189
) {
9290
super(undefined, _submenu.actions.find(action => action.id === 'workbench.action.quickOpenWithModes') ?? _submenu.actions[0], options);
9391
this._hoverDelegate = options.hoverDelegate ?? getDefaultHoverDelegate('mouse');
@@ -167,9 +165,6 @@ class CommandCenterCenterViewItem extends BaseActionViewItem {
167165
labelElement.innerText = this._getLabel();
168166
}));
169167

170-
this._store.add(that._accessibilityService.onDidChangeScreenReaderOptimized(() => labelElement.innerText = this._getLabel(true)));
171-
172-
173168
// update label & tooltip when tabs visibility changes
174169
this._store.add(that._editorGroupService.onDidChangeEditorPartOptions(({ newPartOptions, oldPartOptions }) => {
175170
if (newPartOptions.showTabs !== oldPartOptions.showTabs) {
@@ -183,10 +178,10 @@ class CommandCenterCenterViewItem extends BaseActionViewItem {
183178
return that.getTooltip();
184179
}
185180

186-
private _getLabel(screenReaderModeChanged?: boolean): string {
181+
private _getLabel(): string {
187182
const { prefix, suffix } = that._windowTitle.getTitleDecorations();
188183
let label = that._windowTitle.workspaceName;
189-
if (screenReaderModeChanged || that._windowTitle.isCustomTitleFormat()) {
184+
if (that._windowTitle.isCustomTitleFormat()) {
190185
label = that._windowTitle.getWindowTitle();
191186
} else if (that._editorGroupService.partOptions.showTabs === 'none') {
192187
label = that._windowTitle.fileName ?? label;

src/vs/workbench/browser/parts/titlebar/windowTitle.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,7 @@ export class WindowTitle extends Disposable {
130130
this.titleUpdater.schedule();
131131
}
132132
}));
133-
this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(() => {
134-
if (this.accessibilityService.isScreenReaderOptimized() && !this.titleIncludesEditorState
135-
|| !this.accessibilityService.isScreenReaderOptimized() && this.titleIncludesEditorState) {
136-
this.titleUpdater.schedule();
137-
}
138-
}));
133+
this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(() => this.titleUpdater.schedule()));
139134
}
140135

141136
private onConfigurationChanged(event: IConfigurationChangeEvent): void {
@@ -413,6 +408,9 @@ export class WindowTitle extends Disposable {
413408
}
414409

415410
isCustomTitleFormat(): boolean {
411+
if (this.accessibilityService.isScreenReaderOptimized() || this.titleIncludesEditorState) {
412+
return true;
413+
}
416414
const title = this.configurationService.inspect<string>(WindowSettingNames.title);
417415
const titleSeparator = this.configurationService.inspect<string>(WindowSettingNames.titleSeparator);
418416

0 commit comments

Comments
 (0)