testing: improve labeling in peek for accessibility
This commit is contained in:
parent
69393e9a2f
commit
269cf7a98c
4 changed files with 27 additions and 0 deletions
|
@ -1151,6 +1151,9 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
|||
} else {
|
||||
result.wordWrapOverride1 = this._diffWordWrap;
|
||||
}
|
||||
if (options.originalAriaLabel) {
|
||||
result.ariaLabel = options.originalAriaLabel;
|
||||
}
|
||||
result.readOnly = !this._originalIsEditable;
|
||||
result.extraEditorClassName = 'original-in-monaco-diff-editor';
|
||||
return {
|
||||
|
@ -1164,6 +1167,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
|||
|
||||
private _adjustOptionsForRightHandSide(options: Readonly<editorBrowser.IDiffEditorConstructionOptions>): editorBrowser.IEditorConstructionOptions {
|
||||
const result = this._adjustOptionsForSubEditor(options);
|
||||
if (options.modifiedAriaLabel) {
|
||||
result.ariaLabel = options.modifiedAriaLabel;
|
||||
}
|
||||
|
||||
result.wordWrapOverride1 = this._diffWordWrap;
|
||||
result.revealHorizontalRightPadding = EditorOptions.revealHorizontalRightPadding.defaultValue + DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH;
|
||||
result.scrollbar!.verticalHasArrows = false;
|
||||
|
|
|
@ -690,6 +690,14 @@ export interface IDiffEditorOptions extends IEditorOptions {
|
|||
* Control the wrapping of the diff editor.
|
||||
*/
|
||||
diffWordWrap?: 'off' | 'on' | 'inherit';
|
||||
/**
|
||||
* Aria label for original editor.
|
||||
*/
|
||||
originalAriaLabel?: string;
|
||||
/**
|
||||
* Aria label for modifed editor.
|
||||
*/
|
||||
modifiedAriaLabel?: string;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
|
8
src/vs/monaco.d.ts
vendored
8
src/vs/monaco.d.ts
vendored
|
@ -3247,6 +3247,14 @@ declare namespace monaco.editor {
|
|||
* Control the wrapping of the diff editor.
|
||||
*/
|
||||
diffWordWrap?: 'off' | 'on' | 'inherit';
|
||||
/**
|
||||
* Aria label for original editor.
|
||||
*/
|
||||
originalAriaLabel?: string;
|
||||
/**
|
||||
* Aria label for modifed editor.
|
||||
*/
|
||||
modifiedAriaLabel?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { alert } from 'vs/base/browser/ui/aria/aria';
|
||||
import { Codicon } from 'vs/base/common/codicons';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
|
@ -203,6 +204,7 @@ export class TestingOutputPeekController extends Disposable implements IEditorCo
|
|||
this.peek.value!.create();
|
||||
}
|
||||
|
||||
alert(message.message.toString());
|
||||
this.peek.value!.setModel(dto);
|
||||
}
|
||||
|
||||
|
@ -321,6 +323,8 @@ const diffEditorOptions: IDiffEditorOptions = {
|
|||
renderOverviewRuler: false,
|
||||
ignoreTrimWhitespace: false,
|
||||
renderSideBySide: true,
|
||||
originalAriaLabel: localize('testingOutputExpected', 'Expected result'),
|
||||
modifiedAriaLabel: localize('testingOutputActual', 'Actual result'),
|
||||
};
|
||||
|
||||
class TestingDiffOutputPeek extends TestingOutputPeek {
|
||||
|
|
Loading…
Reference in a new issue