Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make accessibility buffer readonly #4381

Merged
merged 10 commits into from
Jan 23, 2023
6 changes: 3 additions & 3 deletions src/browser/AccessibilityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export class AccessibilityManager extends Disposable {

this._accessiblityBuffer = document.createElement('textarea');
this._accessiblityBuffer.ariaLabel = Strings.accessibilityBuffer;
this._accessiblityBuffer.readOnly = true;
this._accessiblityBuffer.classList.add('xterm-accessibility-buffer');
this._accessiblityBuffer.contentEditable = 'true';
this._accessiblityBuffer.addEventListener('focus', () => this._refreshAccessibilityBuffer());
this._terminal.element.insertAdjacentElement('afterbegin', this._accessiblityBuffer);

Expand Down Expand Up @@ -121,6 +121,7 @@ export class AccessibilityManager extends Disposable {
// media query that drives the ScreenDprMonitor isn't supported
this.register(addDisposableDomListener(window, 'resize', () => this._refreshRowsDimensions()));
this.register(toDisposable(() => {
this._accessiblityBuffer.remove();
this._accessibilityTreeRoot.remove();
this._rowElements.length = 0;
}));
Expand Down Expand Up @@ -313,7 +314,7 @@ export class AccessibilityManager extends Disposable {
if (this._charsToAnnounce.length === 0) {
return;
}
this._liveRegion.textContent += this._charsToAnnounce;
this._liveRegion.textContent += this._charsToAnnounce;
meganrogge marked this conversation as resolved.
Show resolved Hide resolved
this._charsToAnnounce = '';
}

Expand All @@ -335,7 +336,6 @@ export class AccessibilityManager extends Disposable {
this._accessiblityBuffer.ariaRoleDescription = 'textbox';
this._accessibilityTreeRoot.spellcheck = false;
this._accessiblityBuffer.scrollTop = this._accessiblityBuffer.scrollHeight;
this._accessiblityBuffer.focus();

const end = this._accessiblityBuffer.value.length;
this._accessiblityBuffer.scrollTop = this._accessiblityBuffer.scrollHeight;
Expand Down