@@ -598,25 +598,27 @@ scrollToBottom = () => { const output = this.outputRef.current; if (output) {
598598 if ( visibleOutput . length === 0 ) return ;
599599
600600 switch ( e . key ) {
601- case 'ArrowDown' :
601+ case 'ArrowDown' : {
602602 e . preventDefault ( ) ;
603- this . setState ( prevState => {
604- const currentIndex = prevState . focusedLineIndex ?? - 1 ;
605- const nextIndex = Math . min ( currentIndex + 1 , visibleOutput . length - 1 ) ;
603+ const currentIndex = this . state . focusedLineIndex ?? - 1 ;
604+ const nextIndex = Math . min ( currentIndex + 1 , visibleOutput . length - 1 ) ;
605+ this . setState ( { focusedLineIndex : nextIndex } , ( ) => {
606606 this . announceOutputLine ( visibleOutput [ nextIndex ] ) ;
607- return { focusedLineIndex : nextIndex } ;
608- } , this . scrollFocusedLineIntoView ) ;
607+ this . scrollFocusedLineIntoView ( ) ;
608+ } ) ;
609609 break ;
610+ }
610611
611- case 'ArrowUp' :
612+ case 'ArrowUp' : {
612613 e . preventDefault ( ) ;
613- this . setState ( prevState => {
614- const currentIndex = prevState . focusedLineIndex ?? visibleOutput . length ;
615- const prevIndex = Math . max ( currentIndex - 1 , 0 ) ;
614+ const currentIndex = this . state . focusedLineIndex ?? visibleOutput . length ;
615+ const prevIndex = Math . max ( currentIndex - 1 , 0 ) ;
616+ this . setState ( { focusedLineIndex : prevIndex } , ( ) => {
616617 this . announceOutputLine ( visibleOutput [ prevIndex ] ) ;
617- return { focusedLineIndex : prevIndex } ;
618- } , this . scrollFocusedLineIntoView ) ;
618+ this . scrollFocusedLineIntoView ( ) ;
619+ } ) ;
619620 break ;
621+ }
620622
621623 case 'Home' :
622624 e . preventDefault ( ) ;
@@ -700,10 +702,7 @@ scrollToBottom = () => { const output = this.outputRef.current; if (output) {
700702 onFocus = { this . handleOutputFocus }
701703 onBlur = { this . handleOutputBlur }
702704 tabIndex = { 0 }
703- role = "log"
704705 aria-label = "Game output log - use arrow keys to navigate"
705- aria-live = "polite"
706- aria-atomic = "false"
707706 >
708707 { visibleOutput . map ( ( line , index ) => (
709708 < div
0 commit comments