Skip to content

Commit a2fee51

Browse files
authored
add command to toggle screen reader accessibility mode (microsoft#166412)
fix microsoft#166154
1 parent d0d28a6 commit a2fee51

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
216216
}
217217
break;
218218
case 'on':
219-
text += '\n\n - ' + nls.localize('configuredOn', "The editor is configured to be permanently optimized for usage with a Screen Reader - you can change this by editing the setting `editor.accessibilitySupport`.");
219+
text += '\n\n - ' + nls.localize('configuredOn', "The editor is configured to be permanently optimized for usage with a Screen Reader - you can change this via the command `Toggle Screen Reader Accessibility Mode` or by editing the setting `editor.accessibilitySupport`");
220220
break;
221221
case 'off':
222222
text += '\n\n - ' + nls.localize('configuredOff', "The editor is configured to never be optimized for usage with a Screen Reader.");
@@ -327,3 +327,22 @@ registerEditorCommand(new AccessibilityHelpCommand({
327327
primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape]
328328
}
329329
}));
330+
331+
class ToggleScreenReaderMode extends Action2 {
332+
333+
constructor() {
334+
super({
335+
id: 'editor.action.toggleScreenReaderAccessibilityMode',
336+
title: { value: nls.localize('toggleScreenReaderMode', "Toggle Screen Reader Accessibility Mode"), original: 'Toggle Screen Reader Accessibility Mode' },
337+
f1: true,
338+
});
339+
}
340+
341+
async run(accessor: ServicesAccessor): Promise<void> {
342+
const configurationService = accessor.get(IConfigurationService);
343+
const value = configurationService.getValue('editor.accessibilitySupport');
344+
configurationService.updateValue('editor.accessibilitySupport', value === 'on' ? 'off' : 'on');
345+
}
346+
}
347+
348+
registerAction2(ToggleScreenReaderMode);

0 commit comments

Comments
 (0)