Skip to content

Commit 0b56255

Browse files
authored
Merge pull request #4284 from JasonXJ/a11y-2
Fix a11y issues #4269
2 parents f79644b + d177acc commit 0b56255

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

src/browser/AccessibilityManager.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,10 @@ export class AccessibilityManager extends Disposable {
246246

247247
private _handleKey(keyChar: string): void {
248248
this._clearLiveRegion();
249-
this._charsToConsume.push(keyChar);
249+
// Only add the char if there is no control character.
250+
if (!/\p{Control}/u.test(keyChar)) {
251+
this._charsToConsume.push(keyChar);
252+
}
250253
}
251254

252255
private _refreshRows(start?: number, end?: number): void {

src/browser/Terminal.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,11 @@ export class Terminal extends CoreTerminal implements ITerminal {
445445
this.textarea = document.createElement('textarea');
446446
this.textarea.classList.add('xterm-helper-textarea');
447447
this.textarea.setAttribute('aria-label', Strings.promptLabel);
448-
this.textarea.setAttribute('aria-multiline', 'false');
448+
if (!Browser.isChromeOS) {
449+
// ChromeVox on ChromeOS does not like this. See
450+
// https://issuetracker.google.com/issues/260170397
451+
this.textarea.setAttribute('aria-multiline', 'false');
452+
}
449453
this.textarea.setAttribute('autocorrect', 'off');
450454
this.textarea.setAttribute('autocapitalize', 'off');
451455
this.textarea.setAttribute('spellcheck', 'false');
@@ -1057,10 +1061,10 @@ export class Terminal extends CoreTerminal implements ITerminal {
10571061
this.coreService.triggerDataEvent(result.key, true);
10581062

10591063
// Cancel events when not in screen reader mode so events don't get bubbled up and handled by
1060-
// other listeners. When screen reader mode is enabled, this could cause issues if the event
1061-
// is handled at a higher level, this is a compromise in order to echo keys to the screen
1062-
// reader.
1063-
if (!this.optionsService.rawOptions.screenReaderMode) {
1064+
// other listeners. When screen reader mode is enabled, we don't cancel them (unless ctrl or alt
1065+
// is also depressed) so that the cursor textarea can be updated, which triggers the screen
1066+
// reader to read it.
1067+
if (!this.optionsService.rawOptions.screenReaderMode || event.altKey || event.ctrlKey) {
10641068
return this.cancel(event, true);
10651069
}
10661070

src/common/Platform.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ export const isIpad = platform === 'iPad';
3939
export const isIphone = platform === 'iPhone';
4040
export const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(platform);
4141
export const isLinux = platform.indexOf('Linux') >= 0;
42+
// Note that when this is true, isLinux will also be true.
43+
export const isChromeOS = /\bCrOS\b/.test(userAgent);

0 commit comments

Comments
 (0)