add content editable setting, allow non-screen reader users to use accessible buffer (#173322)

This commit is contained in:
Megan Rogge
2023-02-06 09:48:29 -06:00
committed by GitHub
parent 90c3ebe980
commit d896f7bcd4
11 changed files with 55 additions and 38 deletions
+2 -2
View File
@@ -87,13 +87,13 @@
"vscode-proxy-agent": "^0.12.0", "vscode-proxy-agent": "^0.12.0",
"vscode-regexpp": "^3.1.0", "vscode-regexpp": "^3.1.0",
"vscode-textmate": "8.0.0", "vscode-textmate": "8.0.0",
"xterm": "5.2.0-beta.24", "xterm": "5.2.0-beta.26",
"xterm-addon-canvas": "0.4.0-beta.7", "xterm-addon-canvas": "0.4.0-beta.7",
"xterm-addon-search": "0.11.0", "xterm-addon-search": "0.11.0",
"xterm-addon-serialize": "0.9.0", "xterm-addon-serialize": "0.9.0",
"xterm-addon-unicode11": "0.5.0", "xterm-addon-unicode11": "0.5.0",
"xterm-addon-webgl": "0.15.0-beta.6", "xterm-addon-webgl": "0.15.0-beta.6",
"xterm-headless": "5.2.0-beta.24", "xterm-headless": "5.2.0-beta.26",
"yauzl": "^2.9.2", "yauzl": "^2.9.2",
"yazl": "^2.4.3" "yazl": "^2.4.3"
}, },
+2 -2
View File
@@ -24,13 +24,13 @@
"vscode-proxy-agent": "^0.12.0", "vscode-proxy-agent": "^0.12.0",
"vscode-regexpp": "^3.1.0", "vscode-regexpp": "^3.1.0",
"vscode-textmate": "8.0.0", "vscode-textmate": "8.0.0",
"xterm": "5.2.0-beta.24", "xterm": "5.2.0-beta.26",
"xterm-addon-canvas": "0.4.0-beta.7", "xterm-addon-canvas": "0.4.0-beta.7",
"xterm-addon-search": "0.11.0", "xterm-addon-search": "0.11.0",
"xterm-addon-serialize": "0.9.0", "xterm-addon-serialize": "0.9.0",
"xterm-addon-unicode11": "0.5.0", "xterm-addon-unicode11": "0.5.0",
"xterm-addon-webgl": "0.15.0-beta.6", "xterm-addon-webgl": "0.15.0-beta.6",
"xterm-headless": "5.2.0-beta.24", "xterm-headless": "5.2.0-beta.26",
"yauzl": "^2.9.2", "yauzl": "^2.9.2",
"yazl": "^2.4.3" "yazl": "^2.4.3"
}, },
+1 -1
View File
@@ -11,7 +11,7 @@
"tas-client-umd": "0.1.6", "tas-client-umd": "0.1.6",
"vscode-oniguruma": "1.7.0", "vscode-oniguruma": "1.7.0",
"vscode-textmate": "8.0.0", "vscode-textmate": "8.0.0",
"xterm": "5.2.0-beta.24", "xterm": "5.2.0-beta.26",
"xterm-addon-canvas": "0.4.0-beta.7", "xterm-addon-canvas": "0.4.0-beta.7",
"xterm-addon-search": "0.11.0", "xterm-addon-search": "0.11.0",
"xterm-addon-unicode11": "0.5.0", "xterm-addon-unicode11": "0.5.0",
+4 -4
View File
@@ -88,7 +88,7 @@ xterm-addon-webgl@0.15.0-beta.6:
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.15.0-beta.6.tgz#a99233349b9eaec31df798a312906fe73fb3dc33" resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.15.0-beta.6.tgz#a99233349b9eaec31df798a312906fe73fb3dc33"
integrity sha512-PMEkAT4UFL4Ei222uiHPMdVG3fRQAfS5JuZl9FfRVw0V4qMKHvZxBrZELytVfSgLNGBuPu2z7feeZIFEWQGlhA== integrity sha512-PMEkAT4UFL4Ei222uiHPMdVG3fRQAfS5JuZl9FfRVw0V4qMKHvZxBrZELytVfSgLNGBuPu2z7feeZIFEWQGlhA==
xterm@5.2.0-beta.24: xterm@5.2.0-beta.26:
version "5.2.0-beta.24" version "5.2.0-beta.26"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.24.tgz#a6191457555bc7f0dc1211d2951025cd6c9002fe" resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.26.tgz#9b45e481e10ce6c21b34cb36f7c2b2006ec7a136"
integrity sha512-N/EzDY5LMwj262mEfJMdu30yuYrbyDN3eqr8f+bA3/VywGqvuQLyH+mUNFSwMWUrAriKNVEZF++B6pqJhthHVg== integrity sha512-+jp492Ein/xO+nGjZz0CwAYeyUAK5LoH7N1U5w3HGVjYMLZu/Y/Ql5FO+ax/QrrM3Ob+Rw2JNrTuhMQmIZMIMg==
+8 -8
View File
@@ -866,15 +866,15 @@ xterm-addon-webgl@0.15.0-beta.6:
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.15.0-beta.6.tgz#a99233349b9eaec31df798a312906fe73fb3dc33" resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.15.0-beta.6.tgz#a99233349b9eaec31df798a312906fe73fb3dc33"
integrity sha512-PMEkAT4UFL4Ei222uiHPMdVG3fRQAfS5JuZl9FfRVw0V4qMKHvZxBrZELytVfSgLNGBuPu2z7feeZIFEWQGlhA== integrity sha512-PMEkAT4UFL4Ei222uiHPMdVG3fRQAfS5JuZl9FfRVw0V4qMKHvZxBrZELytVfSgLNGBuPu2z7feeZIFEWQGlhA==
xterm-headless@5.2.0-beta.24: xterm-headless@5.2.0-beta.26:
version "5.2.0-beta.24" version "5.2.0-beta.26"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.2.0-beta.24.tgz#645ac47ababe44d12925f7a991f5459aef4e654b" resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.2.0-beta.26.tgz#6e852a183d6cfb230a7fe19947ed727769dae0bb"
integrity sha512-Hbzb3V8T/HqeHUHKDk1EOPc7BYEhyhTSPTY0/ORwM3dndfhQBHEIRYTBZAA8+5jY3hPwUvyWmYAYO3vqAv61RQ== integrity sha512-v961nK3TVzqrRcaSLJStSwoNfiOXRRwxT0+hBTdWpgHAZAMj93oHBWKuG882kPiyT/kqlxzxdNRvpWKI504eSQ==
xterm@5.2.0-beta.24: xterm@5.2.0-beta.26:
version "5.2.0-beta.24" version "5.2.0-beta.26"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.24.tgz#a6191457555bc7f0dc1211d2951025cd6c9002fe" resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.26.tgz#9b45e481e10ce6c21b34cb36f7c2b2006ec7a136"
integrity sha512-N/EzDY5LMwj262mEfJMdu30yuYrbyDN3eqr8f+bA3/VywGqvuQLyH+mUNFSwMWUrAriKNVEZF++B6pqJhthHVg== integrity sha512-+jp492Ein/xO+nGjZz0CwAYeyUAK5LoH7N1U5w3HGVjYMLZu/Y/Ql5FO+ax/QrrM3Ob+Rw2JNrTuhMQmIZMIMg==
yallist@^4.0.0: yallist@^4.0.0:
version "4.0.0" version "4.0.0"
+2 -1
View File
@@ -114,7 +114,8 @@ export const enum TerminalSettingId {
ShellIntegrationDecorationsEnabled = 'terminal.integrated.shellIntegration.decorationsEnabled', ShellIntegrationDecorationsEnabled = 'terminal.integrated.shellIntegration.decorationsEnabled',
ShellIntegrationCommandHistory = 'terminal.integrated.shellIntegration.history', ShellIntegrationCommandHistory = 'terminal.integrated.shellIntegration.history',
ShellIntegrationSuggestEnabled = 'terminal.integrated.shellIntegration.suggestEnabled', ShellIntegrationSuggestEnabled = 'terminal.integrated.shellIntegration.suggestEnabled',
SmoothScrolling = 'terminal.integrated.smoothScrolling' SmoothScrolling = 'terminal.integrated.smoothScrolling',
AccessibleBufferContentEditable = 'terminal.integrated.accessibleBufferContentEditable'
} }
export const enum TerminalLogConstants { export const enum TerminalLogConstants {
@@ -408,16 +408,18 @@ export function registerTerminalActions() {
registerAction2(class extends Action2 { registerAction2(class extends Action2 {
constructor() { constructor() {
super({ super({
id: TerminalCommandId.EnterAccessibilityMode, id: TerminalCommandId.FocusAccessibleBuffer,
title: { value: localize('workbench.action.terminal.enterAccessibilityMode', 'Enter Accessibility Mode'), original: 'Enter Accessibility Mode' }, title: { value: localize('workbench.action.terminal.focusAccessibleBuffer', 'Focus Accessible Buffer'), original: 'Focus Accessible Buffer' },
f1: true, f1: true,
category, category,
precondition: ContextKeyExpr.and(CONTEXT_ACCESSIBILITY_MODE_ENABLED, ContextKeyExpr.or(TerminalContextKeys.processSupported, TerminalContextKeys.terminalHasBeenCreated)), precondition: ContextKeyExpr.or(TerminalContextKeys.processSupported, TerminalContextKeys.terminalHasBeenCreated),
keybinding: { keybinding: [
primary: KeyMod.Shift | KeyCode.Tab, {
weight: KeybindingWeight.WorkbenchContrib, primary: KeyMod.Shift | KeyCode.Tab,
when: TerminalContextKeys.focus weight: KeybindingWeight.WorkbenchContrib,
} when: ContextKeyExpr.and(CONTEXT_ACCESSIBILITY_MODE_ENABLED, TerminalContextKeys.focus)
}
],
}); });
} }
async run(accessor: ServicesAccessor): Promise<void> { async run(accessor: ServicesAccessor): Promise<void> {
@@ -1108,6 +1108,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
if (!this._accessibilityBuffer) { if (!this._accessibilityBuffer) {
return; return;
} }
const accessibleBufferContentEditable = this._configurationService.getValue(TerminalSettingId.AccessibleBufferContentEditable);
this._accessibilityBuffer.contentEditable = accessibleBufferContentEditable === 'on' || (accessibleBufferContentEditable === 'auto' && !this._accessibilityService.isScreenReaderOptimized()) ? 'true' : 'false';
// The viewport is undefined when this is focused, so we cannot get the cell height from that. Instead, estimate using the font. // The viewport is undefined when this is focused, so we cannot get the cell height from that. Instead, estimate using the font.
const font = this.xterm.getFont(); const font = this.xterm.getFont();
const lineHeight = font?.charHeight ? font.charHeight * font.lineHeight + 'px' : ''; const lineHeight = font?.charHeight ? font.charHeight * font.lineHeight + 'px' : '';
@@ -2675,8 +2677,8 @@ export function parseExitResult(
} }
const introMessage = nls.localize('introMsg', "Welcome to Terminal Accessibility Help"); const introMessage = nls.localize('introMsg', "Welcome to Terminal Accessibility Help");
const enterAccessibilityModeNls = nls.localize('enterAccessibilityMode', 'The Enter Accessibility Mode ({0}) command enables screen readers to read terminal contents.'); const focusAccessibleBufferNls = nls.localize('focusAccessibleBuffer', 'The Focus Accessible Buffer ({0}) command enables screen readers to read terminal contents.');
const enterAccessibilityModeNoKb = nls.localize('enterAccessibilityModeNoKb', 'The Enter Accessibility Mode command enables screen readers to read terminal contents and is currently not triggerable by a keybinding.'); const focusAccessibleBufferNoKb = nls.localize('focusAccessibleBufferNoKb', 'The Focus Accessible Buffer command enables screen readers to read terminal contents and is currently not triggerable by a keybinding.');
const shellIntegration = nls.localize('shellIntegration', "The terminal has a feature called shell integration that offers an enhanced experience and provides useful commands for screen readers such as:"); const shellIntegration = nls.localize('shellIntegration', "The terminal has a feature called shell integration that offers an enhanced experience and provides useful commands for screen readers such as:");
const runRecentCommand = nls.localize('runRecentCommand', 'Run Recent Command ({0})'); const runRecentCommand = nls.localize('runRecentCommand', 'Run Recent Command ({0})');
const runRecentCommandNoKb = nls.localize('runRecentCommandNoKb', 'Run Recent Command is currently not triggerable by a keybinding.'); const runRecentCommandNoKb = nls.localize('runRecentCommandNoKb', 'Run Recent Command is currently not triggerable by a keybinding.');
@@ -2749,7 +2751,7 @@ class AccessibilityHelpWidget extends Widget implements ITerminalWidget {
private _buildContent(): void { private _buildContent(): void {
const content = []; const content = [];
content.push(this._descriptionForCommand(TerminalCommandId.EnterAccessibilityMode, enterAccessibilityModeNls, enterAccessibilityModeNoKb)); content.push(this._descriptionForCommand(TerminalCommandId.FocusAccessibleBuffer, focusAccessibleBufferNls, focusAccessibleBufferNoKb));
if (this._hasShellIntegration) { if (this._hasShellIntegration) {
content.push(shellIntegration); content.push(shellIntegration);
content.push('- ' + this._descriptionForCommand(TerminalCommandId.RunRecentCommand, runRecentCommand, runRecentCommandNoKb) + '\n- ' + this._descriptionForCommand(TerminalCommandId.GoToRecentDirectory, goToRecent, goToRecentNoKb)); content.push('- ' + this._descriptionForCommand(TerminalCommandId.RunRecentCommand, runRecentCommand, runRecentCommandNoKb) + '\n- ' + this._descriptionForCommand(TerminalCommandId.GoToRecentDirectory, goToRecent, goToRecentNoKb));
@@ -253,6 +253,7 @@ export interface ITerminalConfiguration {
}; };
useWslProfiles: boolean; useWslProfiles: boolean;
altClickMovesCursor: boolean; altClickMovesCursor: boolean;
accessibleBufferContentEditable: 'auto' | 'on' | 'off';
macOptionIsMeta: boolean; macOptionIsMeta: boolean;
macOptionClickForcesSelection: boolean; macOptionClickForcesSelection: boolean;
gpuAcceleration: 'auto' | 'on' | 'canvas' | 'off'; gpuAcceleration: 'auto' | 'on' | 'canvas' | 'off';
@@ -490,7 +491,7 @@ export const enum TerminalCommandId {
OpenFileLink = 'workbench.action.terminal.openFileLink', OpenFileLink = 'workbench.action.terminal.openFileLink',
OpenWebLink = 'workbench.action.terminal.openUrlLink', OpenWebLink = 'workbench.action.terminal.openUrlLink',
RunRecentCommand = 'workbench.action.terminal.runRecentCommand', RunRecentCommand = 'workbench.action.terminal.runRecentCommand',
EnterAccessibilityMode = 'workbench.action.terminal.enterAccessibilityMode', FocusAccessibleBuffer = 'workbench.action.terminal.focusAccessibleBuffer',
CopyLastCommandOutput = 'workbench.action.terminal.copyLastCommandOutput', CopyLastCommandOutput = 'workbench.action.terminal.copyLastCommandOutput',
GoToRecentDirectory = 'workbench.action.terminal.goToRecentDirectory', GoToRecentDirectory = 'workbench.action.terminal.goToRecentDirectory',
CopyAndClearSelection = 'workbench.action.terminal.copyAndClearSelection', CopyAndClearSelection = 'workbench.action.terminal.copyAndClearSelection',
@@ -580,6 +580,17 @@ const terminalConfiguration: IConfigurationNode = {
type: 'boolean', type: 'boolean',
default: false default: false
}, },
[TerminalSettingId.AccessibleBufferContentEditable]: {
description: localize('terminal.integrated.accessibleBufferContentEditable', "Controls whether the accessible buffer is marks as a `contenteditable` element. This adds a text cursor to the buffer, allowing selection with the keyboard without a screen reader. Screen reader will typically want to leave this as `'auto'` or `'off'` which will treat the buffer similar to a document."),
type: 'string',
enum: ['auto', 'on', 'off'],
enumDescriptions: [
localize('accessibleBufferContentEditable.auto', "Automatically enable when a screen reader is not detected."),
localize('accessibleBufferContentEditable.on', "Always on."),
localize('accessibleBufferContentEditable.off', "Always off.")
],
default: 'auto'
}
} }
}; };
+8 -8
View File
@@ -11728,15 +11728,15 @@ xterm-addon-webgl@0.15.0-beta.6:
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.15.0-beta.6.tgz#a99233349b9eaec31df798a312906fe73fb3dc33" resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.15.0-beta.6.tgz#a99233349b9eaec31df798a312906fe73fb3dc33"
integrity sha512-PMEkAT4UFL4Ei222uiHPMdVG3fRQAfS5JuZl9FfRVw0V4qMKHvZxBrZELytVfSgLNGBuPu2z7feeZIFEWQGlhA== integrity sha512-PMEkAT4UFL4Ei222uiHPMdVG3fRQAfS5JuZl9FfRVw0V4qMKHvZxBrZELytVfSgLNGBuPu2z7feeZIFEWQGlhA==
xterm-headless@5.2.0-beta.24: xterm-headless@5.2.0-beta.26:
version "5.2.0-beta.24" version "5.2.0-beta.26"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.2.0-beta.24.tgz#645ac47ababe44d12925f7a991f5459aef4e654b" resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.2.0-beta.26.tgz#6e852a183d6cfb230a7fe19947ed727769dae0bb"
integrity sha512-Hbzb3V8T/HqeHUHKDk1EOPc7BYEhyhTSPTY0/ORwM3dndfhQBHEIRYTBZAA8+5jY3hPwUvyWmYAYO3vqAv61RQ== integrity sha512-v961nK3TVzqrRcaSLJStSwoNfiOXRRwxT0+hBTdWpgHAZAMj93oHBWKuG882kPiyT/kqlxzxdNRvpWKI504eSQ==
xterm@5.2.0-beta.24: xterm@5.2.0-beta.26:
version "5.2.0-beta.24" version "5.2.0-beta.26"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.24.tgz#a6191457555bc7f0dc1211d2951025cd6c9002fe" resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.26.tgz#9b45e481e10ce6c21b34cb36f7c2b2006ec7a136"
integrity sha512-N/EzDY5LMwj262mEfJMdu30yuYrbyDN3eqr8f+bA3/VywGqvuQLyH+mUNFSwMWUrAriKNVEZF++B6pqJhthHVg== integrity sha512-+jp492Ein/xO+nGjZz0CwAYeyUAK5LoH7N1U5w3HGVjYMLZu/Y/Ql5FO+ax/QrrM3Ob+Rw2JNrTuhMQmIZMIMg==
y18n@^3.2.1: y18n@^3.2.1:
version "3.2.2" version "3.2.2"