Skip to content

Commit 9caf8d7

Browse files
committed
Have other places respect editor.accessibilitySupport (#27833, #27893)
1 parent 309963a commit 9caf8d7

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

src/vs/editor/contrib/gotoError/browser/gotoError.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { registerColor, oneOf } from 'vs/platform/theme/common/colorRegistry';
2727
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
2828
import { Color } from 'vs/base/common/color';
2929
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
30-
import { getAccessibilitySupport } from 'vs/base/browser/browser';
3130
import { AccessibilitySupport } from 'vs/base/common/platform';
3231
import { editorErrorForeground, editorErrorBorder, editorWarningForeground, editorWarningBorder } from 'vs/editor/common/view/editorColorRegistry';
3332

@@ -279,7 +278,7 @@ class MarkerNavigationWidget extends ZoneWidget {
279278

280279
public show(where: Position, heightInLines: number): void {
281280
super.show(where, heightInLines);
282-
if (getAccessibilitySupport() !== AccessibilitySupport.Disabled) {
281+
if (this.editor.getConfiguration().accessibilitySupport !== AccessibilitySupport.Disabled) {
283282
this.focus();
284283
}
285284
}

src/vs/workbench/browser/parts/editor/editorStatus.ts

+21-9
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import paths = require('vs/base/common/paths');
1414
import types = require('vs/base/common/types');
1515
import uri from 'vs/base/common/uri';
1616
import errors = require('vs/base/common/errors');
17-
import * as browser from 'vs/base/browser/browser';
1817
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
1918
import { Action } from 'vs/base/common/actions';
2019
import { language, LANGUAGE_DEFAULT, AccessibilitySupport } from 'vs/base/common/platform';
@@ -47,6 +46,7 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile
4746
import { getCodeEditor as getEditorWidget } from 'vs/editor/common/services/codeEditorService';
4847
import { IPreferencesService } from 'vs/workbench/parts/preferences/common/preferences';
4948
import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
49+
import { IConfigurationChangedEvent } from "vs/editor/common/config/editorOptions";
5050

5151
function toEditorWithEncodingSupport(input: IEditorInput): IEncodingSupport {
5252
if (input instanceof SideBySideEditorInput) {
@@ -329,9 +329,7 @@ export class EditorStatus implements IStatusbarItem {
329329
this.untitledEditorService.onDidChangeEncoding(r => this.onResourceEncodingChange(r)),
330330
this.textFileService.models.onModelEncodingChanged(e => this.onResourceEncodingChange(e.resource)),
331331
TabFocus.onDidChangeTabFocus(e => this.onTabFocusModeChange()),
332-
browser.onDidChangeAccessibilitySupport(() => this.onScreenReaderModeChange())
333332
);
334-
this.onScreenReaderModeChange();
335333

336334
return combinedDisposable(this.toDispose);
337335
}
@@ -492,6 +490,7 @@ export class EditorStatus implements IStatusbarItem {
492490
const control = getEditorWidget(activeEditor);
493491

494492
// Update all states
493+
this.onScreenReaderModeChange(control);
495494
this.onSelectionChange(control);
496495
this.onModeChange(control);
497496
this.onEOLChange(control);
@@ -505,6 +504,13 @@ export class EditorStatus implements IStatusbarItem {
505504
// Attach new listeners to active editor
506505
if (control) {
507506

507+
// Hook Listener for Configuration changes
508+
this.activeEditorListeners.push(control.onDidChangeConfiguration((event: IConfigurationChangedEvent) => {
509+
if (event.accessibilitySupport) {
510+
this.onScreenReaderModeChange(control);
511+
}
512+
}));
513+
508514
// Hook Listener for Selection changes
509515
this.activeEditorListeners.push(control.onDidChangeCursorPosition((event: ICursorPositionChangedEvent) => {
510516
this.onSelectionChange(control);
@@ -595,6 +601,18 @@ export class EditorStatus implements IStatusbarItem {
595601
this.updateState(update);
596602
}
597603

604+
private onScreenReaderModeChange(editorWidget: ICommonCodeEditor): void {
605+
let screenReaderMode = false;
606+
607+
// We only support text based editors
608+
if (editorWidget) {
609+
610+
screenReaderMode = (editorWidget.getConfiguration().accessibilitySupport === AccessibilitySupport.Enabled);
611+
}
612+
613+
this.updateState({ screenReaderMode: screenReaderMode });
614+
}
615+
598616
private onSelectionChange(editorWidget: ICommonCodeEditor): void {
599617
const info: IEditorSelectionStatus = {};
600618

@@ -685,12 +703,6 @@ export class EditorStatus implements IStatusbarItem {
685703
this.updateState(info);
686704
}
687705

688-
private onScreenReaderModeChange(): void {
689-
const info: StateDelta = { screenReaderMode: browser.getAccessibilitySupport() === AccessibilitySupport.Enabled };
690-
691-
this.updateState(info);
692-
}
693-
694706
private isActiveEditor(e: IBaseEditor): boolean {
695707
const activeEditor = this.editorService.getActiveEditor();
696708

0 commit comments

Comments
 (0)