accessibilityBuffer -> accessibleBuffer (#173863)

This commit is contained in:
Megan Rogge 2023-02-08 13:21:40 -06:00 committed by GitHub
parent edf887d889
commit 838b072617
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 21 deletions

View file

@ -703,11 +703,6 @@ export interface ITerminalInstance {
*/
detachProcessAndDispose(reason: TerminalExitReason): Promise<void>;
/**
* Focuses the terminal buffer accessibility element
*/
focusAccessibilityBuffer(): void;
/**
* Check if anything is selected in terminal.
*/
@ -1058,7 +1053,7 @@ export interface IXtermTerminal {
/**
* Focuses the accessible buffer, updating its contents
*/
focusAccessibilityBuffer(): void;
focusAccessibleBuffer(): void;
}
export interface IInternalXtermTerminal {

View file

@ -423,7 +423,7 @@ export function registerTerminalActions() {
});
}
async run(accessor: ServicesAccessor): Promise<void> {
accessor.get(ITerminalService).activeInstance?.focusAccessibilityBuffer();
accessor.get(ITerminalService).activeInstance?.xterm?.focusAccessibleBuffer();
}
});
registerAction2(class extends Action2 {

View file

@ -122,7 +122,7 @@ function getXtermConstructor(): Promise<typeof XTermTerminal> {
// Localize strings
Terminal.strings.promptLabel = nls.localize('terminal.integrated.a11yPromptLabel', 'Terminal input');
Terminal.strings.tooMuchOutput = nls.localize('terminal.integrated.a11yTooMuchOutput', 'Too much output to announce, navigate to rows manually to read');
Terminal.strings.accessibilityBuffer = nls.localize('terminal.integrated.accessibilityBuffer', 'Terminal buffer');
Terminal.strings.accessibilityBuffer = nls.localize('terminal.integrated.accessibleBuffer', 'Terminal buffer');
resolve(Terminal);
});
return xtermConstructor;
@ -1099,10 +1099,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
}
focusAccessibilityBuffer(): void {
this.xterm?.focusAccessibilityBuffer();
}
private _setShellIntegrationContextKey(): void {
if (this.xterm) {
this._terminalShellIntegrationEnabledContextKey.set(this.xterm.shellIntegration.status === ShellIntegrationStatus.VSCode);

View file

@ -281,7 +281,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal, II
});
}
focusAccessibilityBuffer(): void {
focusAccessibleBuffer(): void {
this._accessibileBuffer?.focus();
}
@ -766,7 +766,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal, II
class AccessibleBuffer extends DisposableStore {
private _accessibilityBuffer: HTMLElement | undefined;
private _accessibleBuffer: HTMLElement | undefined;
private _bufferElementFragment: DocumentFragment | undefined;
constructor(
@ -784,23 +784,23 @@ class AccessibleBuffer extends DisposableStore {
if (!this._bufferElementFragment) {
this._bufferElementFragment = document.createDocumentFragment();
}
this._accessibilityBuffer = this._terminal.element?.querySelector('.xterm-accessibility-buffer') as HTMLElement || undefined;
if (!this._accessibilityBuffer) {
this._accessibleBuffer = this._terminal.element?.querySelector('.xterm-accessibility-buffer') as HTMLElement || undefined;
if (!this._accessibleBuffer) {
return this._bufferElementFragment;
}
// see https://github.com/microsoft/vscode/issues/173532
const accessibleBufferContentEditable = isLinux ? 'on' : this._configurationService.getValue(TerminalSettingId.AccessibleBufferContentEditable);
this._accessibilityBuffer.contentEditable = accessibleBufferContentEditable === 'on' || (accessibleBufferContentEditable === 'auto' && !this._accessibilityService.isScreenReaderOptimized()) ? 'true' : 'false';
this._accessibleBuffer.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 lineHeight = this._font?.charHeight ? this._font.charHeight * this._font.lineHeight + 'px' : '';
this._accessibilityBuffer.style.lineHeight = lineHeight;
this._accessibleBuffer.style.lineHeight = lineHeight;
const commands = this._capabilities.get(TerminalCapability.CommandDetection)?.commands;
if (!commands?.length) {
const noContent = document.createElement('div');
const noContentLabel = localize('terminal.integrated.noContent', "No terminal content available for this session.");
noContent.textContent = noContentLabel;
this._bufferElementFragment.replaceChildren(noContent);
this._accessibilityBuffer.focus();
this._accessibleBuffer.focus();
return this._bufferElementFragment;
}
let header;
@ -825,8 +825,8 @@ class AccessibleBuffer extends DisposableStore {
this._bufferElementFragment.appendChild(output);
}
}
this._accessibilityBuffer.focus();
if (this._accessibilityBuffer.contentEditable === 'true') {
this._accessibleBuffer.focus();
if (this._accessibleBuffer.contentEditable === 'true') {
document.execCommand('selectAll', false, undefined);
document.getSelection()?.collapseToEnd();
} else if (header) {