mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 17:48:56 +01:00
Merge pull request #180365 from microsoft/merogge/acc
add accessibility verbosity settings for terminal and diff editor aria hints
This commit is contained in:
@@ -58,6 +58,7 @@ import { defaultInsertColor, defaultRemoveColor, diffDiagonalFill, diffInserted,
|
||||
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
|
||||
import { getThemeTypeSelector, IColorTheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { ThemeIcon } from 'vs/base/common/themables';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
export interface IDiffCodeEditorWidgetOptions {
|
||||
originalEditor?: ICodeEditorWidgetOptions;
|
||||
@@ -249,11 +250,16 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
@IThemeService themeService: IThemeService,
|
||||
@INotificationService notificationService: INotificationService,
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@IEditorProgressService private readonly _editorProgressService: IEditorProgressService
|
||||
@IEditorProgressService private readonly _editorProgressService: IEditorProgressService,
|
||||
@IConfigurationService private readonly _configurationService: IConfigurationService
|
||||
) {
|
||||
super();
|
||||
codeEditorService.willCreateDiffEditor();
|
||||
|
||||
this._register(this._configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration('accessibility.verbosity.diff-editor')) {
|
||||
this.updateOptions(this._options);
|
||||
}
|
||||
}));
|
||||
this._documentDiffProvider = this._register(instantiationService.createInstance(WorkerBasedDocumentDiffProvider, options));
|
||||
this._register(this._documentDiffProvider.onDidChange(e => this._beginUpdateDecorationsSoon()));
|
||||
|
||||
@@ -1272,7 +1278,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
if (options.originalAriaLabel) {
|
||||
result.ariaLabel = options.originalAriaLabel;
|
||||
}
|
||||
result.ariaLabel += ariaNavigationTip;
|
||||
this._updateAriaLabel(result);
|
||||
result.readOnly = !this._options.originalEditable;
|
||||
result.dropIntoEditor = { enabled: !result.readOnly };
|
||||
result.extraEditorClassName = 'original-in-monaco-diff-editor';
|
||||
@@ -1285,12 +1291,22 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
};
|
||||
}
|
||||
|
||||
private _updateAriaLabel(options: IEditorConstructionOptions): void {
|
||||
let ariaLabel = options.ariaLabel;
|
||||
if (this._configurationService.getValue('accessibility.verbosity.diff-editor')) {
|
||||
ariaLabel += ariaNavigationTip;
|
||||
} else if (ariaLabel) {
|
||||
ariaLabel = ariaLabel.replaceAll(ariaNavigationTip, '');
|
||||
}
|
||||
options.ariaLabel = ariaLabel;
|
||||
}
|
||||
|
||||
private _adjustOptionsForRightHandSide(options: Readonly<editorBrowser.IDiffEditorConstructionOptions>): IEditorConstructionOptions {
|
||||
const result = this._adjustOptionsForSubEditor(options);
|
||||
if (options.modifiedAriaLabel) {
|
||||
result.ariaLabel = options.modifiedAriaLabel;
|
||||
}
|
||||
result.ariaLabel += ariaNavigationTip;
|
||||
this._updateAriaLabel(result);
|
||||
result.wordWrapOverride1 = this._options.diffWordWrap;
|
||||
result.revealHorizontalRightPadding = EditorOptions.revealHorizontalRightPadding.defaultValue + DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH;
|
||||
result.scrollbar!.verticalHasArrows = false;
|
||||
|
||||
@@ -20,6 +20,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
|
||||
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { ILanguageConfigurationService } from 'vs/editor/common/languages/languageConfigurationRegistry';
|
||||
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
export class EmbeddedCodeEditorWidget extends CodeEditorWidget {
|
||||
|
||||
@@ -85,8 +86,9 @@ export class EmbeddedDiffEditorWidget extends DiffEditorWidget {
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
@IEditorProgressService editorProgressService: IEditorProgressService,
|
||||
@IConfigurationService configurationService: IConfigurationService
|
||||
) {
|
||||
super(domElement, parentEditor.getRawOptions(), codeEditorWidgetOptions, clipboardService, contextKeyService, instantiationService, codeEditorService, themeService, notificationService, contextMenuService, editorProgressService);
|
||||
super(domElement, parentEditor.getRawOptions(), codeEditorWidgetOptions, clipboardService, contextKeyService, instantiationService, codeEditorService, themeService, notificationService, contextMenuService, editorProgressService, configurationService);
|
||||
|
||||
this._parentEditor = parentEditor;
|
||||
this._overwriteOptions = options;
|
||||
|
||||
Reference in New Issue
Block a user