Merge pull request #188294 from microsoft/merogge/screen-reader-message
inform screen reader user how to enter optimized mode in editorpull/188178/head
commit
d1177d5987
|
@ -35,6 +35,7 @@ import { TokenizationRegistry } from 'vs/editor/common/languages';
|
|||
import { ColorId, ITokenPresentation } from 'vs/editor/common/encodedTokenAttributes';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { IME } from 'vs/base/common/ime';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
|
||||
export interface IVisibleRangeProvider {
|
||||
visibleRangeForPosition(position: Position): HorizontalPosition | null;
|
||||
|
@ -140,7 +141,12 @@ export class TextAreaHandler extends ViewPart {
|
|||
public readonly textAreaCover: FastDomNode<HTMLElement>;
|
||||
private readonly _textAreaInput: TextAreaInput;
|
||||
|
||||
constructor(context: ViewContext, viewController: ViewController, visibleRangeProvider: IVisibleRangeProvider) {
|
||||
constructor(
|
||||
context: ViewContext,
|
||||
viewController: ViewController,
|
||||
visibleRangeProvider: IVisibleRangeProvider,
|
||||
@IKeybindingService private readonly _keybindingService: IKeybindingService
|
||||
) {
|
||||
super(context);
|
||||
|
||||
this._viewController = viewController;
|
||||
|
@ -553,7 +559,21 @@ export class TextAreaHandler extends ViewPart {
|
|||
private _getAriaLabel(options: IComputedEditorOptions): string {
|
||||
const accessibilitySupport = options.get(EditorOption.accessibilitySupport);
|
||||
if (accessibilitySupport === AccessibilitySupport.Disabled) {
|
||||
return nls.localize('accessibilityOffAriaLabel', "The editor is not accessible at this time. Press {0} for options.", platform.isLinux ? 'Shift+Alt+F1' : 'Alt+F1');
|
||||
|
||||
const toggleKeybindingLabel = this._keybindingService.lookupKeybinding('editor.action.toggleScreenReaderAccessibilityMode')?.getAriaLabel();
|
||||
const runCommandKeybindingLabel = this._keybindingService.lookupKeybinding('workbench.action.showCommands')?.getAriaLabel();
|
||||
const keybindingEditorKeybindingLabel = this._keybindingService.lookupKeybinding('workbench.action.openGlobalKeybindings')?.getAriaLabel();
|
||||
const editorNotAccessibleMessage = nls.localize('accessibilityModeOff', "The editor is not accessible at this time.");
|
||||
if (toggleKeybindingLabel) {
|
||||
return nls.localize('accessibilityOffAriaLabel', "{0} To enable screen reader optimized mode, use {1}", editorNotAccessibleMessage, toggleKeybindingLabel);
|
||||
} else if (runCommandKeybindingLabel) {
|
||||
return nls.localize('accessibilityOffAriaLabelNoKb', "{0} To enable screen reader optimized mode, open the quick pick with {1} and run the command Toggle Screen Reader Accessibility Mode, which is currently not triggerable via keyboard.", editorNotAccessibleMessage, runCommandKeybindingLabel);
|
||||
} else if (keybindingEditorKeybindingLabel) {
|
||||
return nls.localize('accessibilityOffAriaLabelNoKbs', "{0} Please assign a keybinding for the command Toggle Screen Reader Accessibility Mode by accessing the keybindings editor with {1} and run it.", editorNotAccessibleMessage, keybindingEditorKeybindingLabel);
|
||||
} else {
|
||||
// SOS
|
||||
return editorNotAccessibleMessage;
|
||||
}
|
||||
}
|
||||
return options.get(EditorOption.ariaLabel);
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
|
|||
import { WhitespaceOverlay } from 'vs/editor/browser/viewParts/whitespace/whitespace';
|
||||
import { GlyphMarginWidgets } from 'vs/editor/browser/viewParts/glyphMargin/glyphMargin';
|
||||
import { GlyphMarginLane } from 'vs/editor/common/model';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
|
||||
export interface IContentWidgetData {
|
||||
|
@ -106,7 +107,8 @@ export class View extends ViewEventHandler {
|
|||
colorTheme: IColorTheme,
|
||||
model: IViewModel,
|
||||
userInputEvents: ViewUserInputEvents,
|
||||
overflowWidgetsDomNode: HTMLElement | undefined
|
||||
overflowWidgetsDomNode: HTMLElement | undefined,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService
|
||||
) {
|
||||
super();
|
||||
this._selections = [new Selection(1, 1, 1, 1)];
|
||||
|
@ -123,7 +125,7 @@ export class View extends ViewEventHandler {
|
|||
this._viewParts = [];
|
||||
|
||||
// Keyboard handler
|
||||
this._textAreaHandler = new TextAreaHandler(this._context, viewController, this._createTextAreaHandlerHelper());
|
||||
this._textAreaHandler = this._instantiationService.createInstance(TextAreaHandler, this._context, viewController, this._createTextAreaHandlerHelper());
|
||||
this._viewParts.push(this._textAreaHandler);
|
||||
|
||||
// These two dom nodes must be constructed up front, since references are needed in the layout provider (scrolling & co.)
|
||||
|
|
|
@ -1853,7 +1853,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
|||
this._themeService.getColorTheme(),
|
||||
viewModel,
|
||||
viewUserInputEvents,
|
||||
this._overflowWidgetsDomNode
|
||||
this._overflowWidgetsDomNode,
|
||||
this._instantiationService
|
||||
);
|
||||
|
||||
return [view, true];
|
||||
|
|
|
@ -22,11 +22,15 @@ class ToggleScreenReaderMode extends Action2 {
|
|||
id: 'editor.action.toggleScreenReaderAccessibilityMode',
|
||||
title: { value: nls.localize('toggleScreenReaderMode', "Toggle Screen Reader Accessibility Mode"), original: 'Toggle Screen Reader Accessibility Mode' },
|
||||
f1: true,
|
||||
keybinding: {
|
||||
keybinding: [{
|
||||
primary: KeyMod.CtrlCmd | KeyCode.KeyE,
|
||||
weight: KeybindingWeight.WorkbenchContrib + 10,
|
||||
when: accessibilityHelpIsShown
|
||||
}
|
||||
},
|
||||
{
|
||||
primary: KeyMod.Alt | KeyCode.F3,
|
||||
weight: KeybindingWeight.WorkbenchContrib + 10,
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue