Skip to content

Commit 4641821

Browse files
committed
help menu
1 parent 082c862 commit 4641821

File tree

4 files changed

+22
-23
lines changed

4 files changed

+22
-23
lines changed

src/vs/editor/common/standaloneStrings.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
77

88
export namespace AccessibilityHelpNLS {
99
export const accessibilityHelpTitle = nls.localize('accessibilityHelpTitle', "Accessibility Help");
10-
export const openingDocs = nls.localize("openingDocs", "Now opening the Editor Accessibility documentation page.");
10+
export const openingDocs = nls.localize("openingDocs", "Now opening the Accessibility documentation page.");
1111
export const readonlyDiffEditor = nls.localize("readonlyDiffEditor", "You are in a read-only pane of a diff editor.");
1212
export const editableDiffEditor = nls.localize("editableDiffEditor", "You are in a pane of a diff editor.");
1313
export const readonlyEditor = nls.localize("readonlyEditor", "You are in a read-only code editor");
@@ -20,7 +20,6 @@ export namespace AccessibilityHelpNLS {
2020
export const tabFocusModeOnMsgNoKb = nls.localize("tabFocusModeOnMsgNoKb", "Pressing Tab in the current editor will move focus to the next focusable element. The command {0} is currently not triggerable by a keybinding.");
2121
export const tabFocusModeOffMsg = nls.localize("tabFocusModeOffMsg", "Pressing Tab in the current editor will insert the tab character. Toggle this behavior by pressing {0}.");
2222
export const tabFocusModeOffMsgNoKb = nls.localize("tabFocusModeOffMsgNoKb", "Pressing Tab in the current editor will insert the tab character. The command {0} is currently not triggerable by a keybinding.");
23-
export const openDoc = nls.localize("openDoc", "Press H now to open a browser window with more information related to editor accessibility.");
2423
export const showAccessibilityHelpAction = nls.localize("showAccessibilityHelpAction", "Show Accessibility Help");
2524
}
2625

src/vs/workbench/contrib/accessibility/browser/accessibility.contribution.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle
2323
import { Registry } from 'vs/platform/registry/common/platform';
2424
import { ICommandService } from 'vs/platform/commands/common/commands';
2525
import { NEW_UNTITLED_FILE_COMMAND_ID } from 'vs/workbench/contrib/files/browser/fileConstants';
26-
import { KeyCode } from 'vs/base/common/keyCodes';
27-
import { URI } from 'vs/base/common/uri';
28-
import { IOpenerService } from 'vs/platform/opener/common/opener';
2926
import { ModesHoverController } from 'vs/editor/contrib/hover/browser/hover';
3027
import { withNullAsUndefined } from 'vs/base/common/types';
3128

@@ -39,23 +36,16 @@ class AccessibilityHelpProvider extends Disposable implements IAccessibleContent
3936
}
4037
options: IAccessibleViewOptions = { isHelpMenu: true, ariaLabel: localize('terminal-help-label', "terminal accessibility help") };
4138
id: string = 'editor';
42-
onKeyDown(e: IKeyboardEvent): void {
43-
if (e.keyCode === KeyCode.KeyH) {
44-
alert(AccessibilityHelpNLS.openingDocs);
45-
46-
let url = (this._editor.getRawOptions() as any).accessibilityHelpUrl;
47-
if (typeof url === 'undefined') {
48-
url = 'https://go.microsoft.com/fwlink/?linkid=852450';
49-
}
50-
this._openerService.open(URI.parse(url));
51-
}
52-
}
5339
constructor(
5440
private readonly _editor: ICodeEditor,
55-
@IKeybindingService private readonly _keybindingService: IKeybindingService,
56-
@IOpenerService private readonly _openerService: IOpenerService
41+
@IKeybindingService private readonly _keybindingService: IKeybindingService
5742
) {
5843
super();
44+
let url = (this._editor.getRawOptions() as any).accessibilityHelpUrl;
45+
if (typeof url === 'undefined') {
46+
url = 'https://go.microsoft.com/fwlink/?linkid=852450';
47+
}
48+
this.options.readMoreUrl = url;
5949
}
6050

6151
private _descriptionForCommand(commandId: string, msg: string, noKbMsg: string): string {
@@ -107,7 +97,6 @@ class AccessibilityHelpProvider extends Disposable implements IAccessibleContent
10797
} else {
10898
content.push(this._descriptionForCommand(ToggleTabFocusModeAction.ID, AccessibilityHelpNLS.tabFocusModeOffMsg, AccessibilityHelpNLS.tabFocusModeOffMsgNoKb));
10999
}
110-
content.push(AccessibilityHelpNLS.openDoc);
111100
return content.join('\n');
112101
}
113102
}

src/vs/workbench/contrib/accessibility/browser/accessibleView.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ import { EditorExtensionsRegistry } from 'vs/editor/browser/editorExtensions';
1212
import { CodeEditorWidget, ICodeEditorWidgetOptions } from 'vs/editor/browser/widget/codeEditorWidget';
1313
import { ITextModel } from 'vs/editor/common/model';
1414
import { IModelService } from 'vs/editor/common/services/model';
15+
import { AccessibilityHelpNLS } from 'vs/editor/common/standaloneStrings';
1516
import { LinkDetector } from 'vs/editor/contrib/links/browser/links';
1617
import { localize } from 'vs/nls';
1718
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
1819
import { IContextViewDelegate, IContextViewService } from 'vs/platform/contextview/browser/contextView';
1920
import { IInstantiationService, createDecorator } from 'vs/platform/instantiation/common/instantiation';
21+
import { IOpenerService } from 'vs/platform/opener/common/opener';
2022
import { SelectionClipboardContributionID } from 'vs/workbench/contrib/codeEditor/browser/selectionClipboard';
2123
import { getSimpleEditorOptions } from 'vs/workbench/contrib/codeEditor/browser/simpleEditorOptions';
2224
import { IDisposable } from 'xterm';
@@ -45,6 +47,7 @@ export interface IAccessibleViewService {
4547
export interface IAccessibleViewOptions {
4648
ariaLabel: string;
4749
isHelpMenu?: boolean;
50+
readMoreUrl?: string;
4851
}
4952

5053

@@ -54,6 +57,7 @@ class AccessibleView extends Disposable {
5457
private _editorContainer: HTMLElement;
5558

5659
constructor(
60+
@IOpenerService private readonly _openerService: IOpenerService,
5761
@IInstantiationService private readonly _instantiationService: IInstantiationService,
5862
@IConfigurationService private readonly _configurationService: IConfigurationService,
5963
@IModelService private readonly _modelService: IModelService,
@@ -99,9 +103,9 @@ class AccessibleView extends Disposable {
99103
private _render(provider: IAccessibleContentProvider, container: HTMLElement): IDisposable {
100104
const settingKey = `accessibility.verbosity.${provider.id}`;
101105
const value = this._configurationService.getValue(settingKey);
102-
106+
const readMoreLink = provider.options.readMoreUrl ? localize("openDoc", "\nPress H now to open a browser window with more information related to accessibility.\n") : '';
103107
const disableHelpHint = provider.options.isHelpMenu && value ? localize('disable-help-hint', '\nTo disable the `accessibility.verbosity` hint for this feature, press D now.\n') : '\n';
104-
const fragment = provider.provideContent() + disableHelpHint + localize('exit-tip', 'Exit this menu via the Escape key.');
108+
const fragment = provider.provideContent() + readMoreLink + disableHelpHint + localize('exit-tip', 'Exit this menu via the Escape key.');
105109

106110
this._getTextModel(URI.from({ path: `accessible-view-${provider.id}`, scheme: 'accessible-view', fragment })).then((model) => {
107111
if (!model) {
@@ -119,6 +123,10 @@ class AccessibleView extends Disposable {
119123
this._contextViewService.hideContextView();
120124
} else if (e.keyCode === KeyCode.KeyD) {
121125
this._configurationService.updateValue(settingKey, false);
126+
} else if (e.keyCode === KeyCode.KeyH && provider.options.readMoreUrl) {
127+
const url: string = provider.options.readMoreUrl!;
128+
alert(AccessibilityHelpNLS.openingDocs);
129+
this._openerService.open(URI.parse(url));
122130
}
123131
e.stopPropagation();
124132
provider.onKeyDown?.(e);

src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibilityHelp.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ export class TerminalAccessibleContentProvider extends Disposable implements IAc
2929
this._instance.focus();
3030
this.dispose();
3131
}
32-
options: IAccessibleViewOptions = { isHelpMenu: true, ariaLabel: localize('terminal-help-label', "terminal accessibility help") };
32+
options: IAccessibleViewOptions = {
33+
isHelpMenu: true,
34+
ariaLabel: localize('terminal-help-label', "terminal accessibility help"),
35+
readMoreUrl: 'https://code.visualstudio.com/docs/editor/accessibility#_terminal-accessibility'
36+
};
3337
id: string = 'terminal';
3438

3539
constructor(
@@ -75,7 +79,6 @@ export class TerminalAccessibleContentProvider extends Disposable implements IAc
7579
content.push(this._descriptionForCommand(TerminalCommandId.OpenDetectedLink, localize('openDetectedLink', 'The Open Detected Link ({0}) command enables screen readers to easily open links found in the terminal.'), localize('openDetectedLinkNoKb', 'The Open Detected Link command enables screen readers to easily open links found in the terminal and is currently not triggerable by a keybinding.')));
7680
content.push(this._descriptionForCommand(TerminalCommandId.NewWithProfile, localize('newWithProfile', 'The Create New Terminal (With Profile) ({0}) command allows for easy terminal creation using a specific profile.'), localize('newWithProfileNoKb', 'The Create New Terminal (With Profile) command allows for easy terminal creation using a specific profile and is currently not triggerable by a keybinding.')));
7781
content.push(localize('accessibilitySettings', 'Access accessibility settings such as `terminal.integrated.tabFocusMode` via the Preferences: Open Accessibility Settings command.'));
78-
content.push(localize('readMore', 'Read more about terminal accessibility https://code.visualstudio.com/docs/editor/accessibility#_terminal-accessibility'));
7982
return content.join('\n');
8083
}
8184
}

0 commit comments

Comments
 (0)