@@ -89,7 +89,7 @@ export class AccessibilityManager extends Disposable {
89
89
if ( ! this . _terminal . element ) {
90
90
throw new Error ( 'Cannot enable accessibility before Terminal.open' ) ;
91
91
}
92
- this . _terminal . element . insertAdjacentElement ( 'afterbegin' , this . _accessibilityTreeRoot ) ;
92
+ // this._terminal.element.insertAdjacentElement('afterbegin', this._accessibilityTreeRoot);
93
93
94
94
this . _fullOutputElement = document . createElement ( 'section' ) ;
95
95
// TODO: Add to strings
@@ -324,7 +324,10 @@ export class AccessibilityManager extends Disposable {
324
324
const outputLines : HTMLElement [ ] = [ ] ;
325
325
let currentLine : string = '' ;
326
326
let lastContentfulElement : HTMLElement | undefined ;
327
- for ( let i = 0 ; i < this . _terminal . buffer . lines . length ; i ++ ) {
327
+ // Cap the number of items in full output, without this screen reader can easily lock up for 20+
328
+ // seconds, probably due to refreshing their a11y tree
329
+ const start = Math . max ( this . _terminal . buffer . lines . length - 100 , 0 ) ;
330
+ for ( let i = start ; i < this . _terminal . buffer . lines . length ; i ++ ) {
328
331
const line = this . _terminal . buffer . lines . get ( i ) ;
329
332
if ( ! line ) {
330
333
continue ;
@@ -341,10 +344,7 @@ export class AccessibilityManager extends Disposable {
341
344
currentLine = '' ;
342
345
}
343
346
}
344
- while ( this . _fullOutputElement . children . length > 0 ) {
345
- this . _fullOutputElement . removeChild ( this . _fullOutputElement . children [ 0 ] ) ;
346
- }
347
- this . _fullOutputElement . append ( ...outputLines ) ;
347
+ this . _fullOutputElement . replaceChildren ( ...outputLines ) ;
348
348
const s = document . getSelection ( ) ;
349
349
if ( s && lastContentfulElement ) {
350
350
s . removeAllRanges ( ) ;
@@ -354,6 +354,7 @@ export class AccessibilityManager extends Disposable {
354
354
r . setEnd ( lastContentfulElement , 0 ) ;
355
355
s . addRange ( r ) ;
356
356
}
357
+ this . _fullOutputElement . scrollTop = this . _fullOutputElement . scrollHeight ;
357
358
// TODO: Delegate API for translating lines into elements
358
359
}
359
360
0 commit comments