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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 55 additions and 38 deletions

View file

@ -87,13 +87,13 @@
"vscode-proxy-agent": "^0.12.0",
"vscode-regexpp": "^3.1.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-search": "0.11.0",
"xterm-addon-serialize": "0.9.0",
"xterm-addon-unicode11": "0.5.0",
"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",
"yazl": "^2.4.3"
},

View file

@ -24,13 +24,13 @@
"vscode-proxy-agent": "^0.12.0",
"vscode-regexpp": "^3.1.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-search": "0.11.0",
"xterm-addon-serialize": "0.9.0",
"xterm-addon-unicode11": "0.5.0",
"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",
"yazl": "^2.4.3"
},

View file

@ -11,7 +11,7 @@
"tas-client-umd": "0.1.6",
"vscode-oniguruma": "1.7.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-search": "0.11.0",
"xterm-addon-unicode11": "0.5.0",

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"
integrity sha512-PMEkAT4UFL4Ei222uiHPMdVG3fRQAfS5JuZl9FfRVw0V4qMKHvZxBrZELytVfSgLNGBuPu2z7feeZIFEWQGlhA==
xterm@5.2.0-beta.24:
version "5.2.0-beta.24"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.24.tgz#a6191457555bc7f0dc1211d2951025cd6c9002fe"
integrity sha512-N/EzDY5LMwj262mEfJMdu30yuYrbyDN3eqr8f+bA3/VywGqvuQLyH+mUNFSwMWUrAriKNVEZF++B6pqJhthHVg==
xterm@5.2.0-beta.26:
version "5.2.0-beta.26"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.26.tgz#9b45e481e10ce6c21b34cb36f7c2b2006ec7a136"
integrity sha512-+jp492Ein/xO+nGjZz0CwAYeyUAK5LoH7N1U5w3HGVjYMLZu/Y/Ql5FO+ax/QrrM3Ob+Rw2JNrTuhMQmIZMIMg==

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"
integrity sha512-PMEkAT4UFL4Ei222uiHPMdVG3fRQAfS5JuZl9FfRVw0V4qMKHvZxBrZELytVfSgLNGBuPu2z7feeZIFEWQGlhA==
xterm-headless@5.2.0-beta.24:
version "5.2.0-beta.24"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.2.0-beta.24.tgz#645ac47ababe44d12925f7a991f5459aef4e654b"
integrity sha512-Hbzb3V8T/HqeHUHKDk1EOPc7BYEhyhTSPTY0/ORwM3dndfhQBHEIRYTBZAA8+5jY3hPwUvyWmYAYO3vqAv61RQ==
xterm-headless@5.2.0-beta.26:
version "5.2.0-beta.26"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.2.0-beta.26.tgz#6e852a183d6cfb230a7fe19947ed727769dae0bb"
integrity sha512-v961nK3TVzqrRcaSLJStSwoNfiOXRRwxT0+hBTdWpgHAZAMj93oHBWKuG882kPiyT/kqlxzxdNRvpWKI504eSQ==
xterm@5.2.0-beta.24:
version "5.2.0-beta.24"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.24.tgz#a6191457555bc7f0dc1211d2951025cd6c9002fe"
integrity sha512-N/EzDY5LMwj262mEfJMdu30yuYrbyDN3eqr8f+bA3/VywGqvuQLyH+mUNFSwMWUrAriKNVEZF++B6pqJhthHVg==
xterm@5.2.0-beta.26:
version "5.2.0-beta.26"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.26.tgz#9b45e481e10ce6c21b34cb36f7c2b2006ec7a136"
integrity sha512-+jp492Ein/xO+nGjZz0CwAYeyUAK5LoH7N1U5w3HGVjYMLZu/Y/Ql5FO+ax/QrrM3Ob+Rw2JNrTuhMQmIZMIMg==
yallist@^4.0.0:
version "4.0.0"

View file

@ -114,7 +114,8 @@ export const enum TerminalSettingId {
ShellIntegrationDecorationsEnabled = 'terminal.integrated.shellIntegration.decorationsEnabled',
ShellIntegrationCommandHistory = 'terminal.integrated.shellIntegration.history',
ShellIntegrationSuggestEnabled = 'terminal.integrated.shellIntegration.suggestEnabled',
SmoothScrolling = 'terminal.integrated.smoothScrolling'
SmoothScrolling = 'terminal.integrated.smoothScrolling',
AccessibleBufferContentEditable = 'terminal.integrated.accessibleBufferContentEditable'
}
export const enum TerminalLogConstants {

View file

@ -408,16 +408,18 @@ export function registerTerminalActions() {
registerAction2(class extends Action2 {
constructor() {
super({
id: TerminalCommandId.EnterAccessibilityMode,
title: { value: localize('workbench.action.terminal.enterAccessibilityMode', 'Enter Accessibility Mode'), original: 'Enter Accessibility Mode' },
id: TerminalCommandId.FocusAccessibleBuffer,
title: { value: localize('workbench.action.terminal.focusAccessibleBuffer', 'Focus Accessible Buffer'), original: 'Focus Accessible Buffer' },
f1: true,
category,
precondition: ContextKeyExpr.and(CONTEXT_ACCESSIBILITY_MODE_ENABLED, ContextKeyExpr.or(TerminalContextKeys.processSupported, TerminalContextKeys.terminalHasBeenCreated)),
keybinding: {
primary: KeyMod.Shift | KeyCode.Tab,
weight: KeybindingWeight.WorkbenchContrib,
when: TerminalContextKeys.focus
}
precondition: ContextKeyExpr.or(TerminalContextKeys.processSupported, TerminalContextKeys.terminalHasBeenCreated),
keybinding: [
{
primary: KeyMod.Shift | KeyCode.Tab,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(CONTEXT_ACCESSIBILITY_MODE_ENABLED, TerminalContextKeys.focus)
}
],
});
}
async run(accessor: ServicesAccessor): Promise<void> {

View file

@ -1108,6 +1108,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
if (!this._accessibilityBuffer) {
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.
const font = this.xterm.getFont();
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 enterAccessibilityModeNls = nls.localize('enterAccessibilityMode', 'The Enter Accessibility Mode ({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 focusAccessibleBufferNls = nls.localize('focusAccessibleBuffer', 'The Focus Accessible Buffer ({0}) command enables screen readers to read terminal contents.');
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 runRecentCommand = nls.localize('runRecentCommand', 'Run Recent Command ({0})');
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 {
const content = [];
content.push(this._descriptionForCommand(TerminalCommandId.EnterAccessibilityMode, enterAccessibilityModeNls, enterAccessibilityModeNoKb));
content.push(this._descriptionForCommand(TerminalCommandId.FocusAccessibleBuffer, focusAccessibleBufferNls, focusAccessibleBufferNoKb));
if (this._hasShellIntegration) {
content.push(shellIntegration);
content.push('- ' + this._descriptionForCommand(TerminalCommandId.RunRecentCommand, runRecentCommand, runRecentCommandNoKb) + '\n- ' + this._descriptionForCommand(TerminalCommandId.GoToRecentDirectory, goToRecent, goToRecentNoKb));

View file

@ -253,6 +253,7 @@ export interface ITerminalConfiguration {
};
useWslProfiles: boolean;
altClickMovesCursor: boolean;
accessibleBufferContentEditable: 'auto' | 'on' | 'off';
macOptionIsMeta: boolean;
macOptionClickForcesSelection: boolean;
gpuAcceleration: 'auto' | 'on' | 'canvas' | 'off';
@ -490,7 +491,7 @@ export const enum TerminalCommandId {
OpenFileLink = 'workbench.action.terminal.openFileLink',
OpenWebLink = 'workbench.action.terminal.openUrlLink',
RunRecentCommand = 'workbench.action.terminal.runRecentCommand',
EnterAccessibilityMode = 'workbench.action.terminal.enterAccessibilityMode',
FocusAccessibleBuffer = 'workbench.action.terminal.focusAccessibleBuffer',
CopyLastCommandOutput = 'workbench.action.terminal.copyLastCommandOutput',
GoToRecentDirectory = 'workbench.action.terminal.goToRecentDirectory',
CopyAndClearSelection = 'workbench.action.terminal.copyAndClearSelection',

View file

@ -580,6 +580,17 @@ const terminalConfiguration: IConfigurationNode = {
type: 'boolean',
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'
}
}
};

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"
integrity sha512-PMEkAT4UFL4Ei222uiHPMdVG3fRQAfS5JuZl9FfRVw0V4qMKHvZxBrZELytVfSgLNGBuPu2z7feeZIFEWQGlhA==
xterm-headless@5.2.0-beta.24:
version "5.2.0-beta.24"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.2.0-beta.24.tgz#645ac47ababe44d12925f7a991f5459aef4e654b"
integrity sha512-Hbzb3V8T/HqeHUHKDk1EOPc7BYEhyhTSPTY0/ORwM3dndfhQBHEIRYTBZAA8+5jY3hPwUvyWmYAYO3vqAv61RQ==
xterm-headless@5.2.0-beta.26:
version "5.2.0-beta.26"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.2.0-beta.26.tgz#6e852a183d6cfb230a7fe19947ed727769dae0bb"
integrity sha512-v961nK3TVzqrRcaSLJStSwoNfiOXRRwxT0+hBTdWpgHAZAMj93oHBWKuG882kPiyT/kqlxzxdNRvpWKI504eSQ==
xterm@5.2.0-beta.24:
version "5.2.0-beta.24"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.24.tgz#a6191457555bc7f0dc1211d2951025cd6c9002fe"
integrity sha512-N/EzDY5LMwj262mEfJMdu30yuYrbyDN3eqr8f+bA3/VywGqvuQLyH+mUNFSwMWUrAriKNVEZF++B6pqJhthHVg==
xterm@5.2.0-beta.26:
version "5.2.0-beta.26"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.26.tgz#9b45e481e10ce6c21b34cb36f7c2b2006ec7a136"
integrity sha512-+jp492Ein/xO+nGjZz0CwAYeyUAK5LoH7N1U5w3HGVjYMLZu/Y/Ql5FO+ax/QrrM3Ob+Rw2JNrTuhMQmIZMIMg==
y18n@^3.2.1:
version "3.2.2"