File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,7 @@ export class Virtual {
205205 #spokenPhraseLog: string [ ] = [ ] ;
206206 #treeCache: AccessibilityNode [ ] | null = null ;
207207 #disconnectDOMObserver: ( ( ) => void ) | null = null ;
208+ #boundHandleFocusChange: ( ( event : Event ) => Promise < void > ) | null = null ;
208209
209210 #checkContainer( ) {
210211 if ( ! this . #container) {
@@ -601,7 +602,9 @@ export class Virtual {
601602 return ;
602603 }
603604
604- this . #container. addEventListener ( "focusin" , this . #handleFocusChange. bind ( this ) ) ;
605+ this . #boundHandleFocusChange = this . #handleFocusChange. bind ( this ) ;
606+
607+ this . #container. addEventListener ( "focusin" , this . #boundHandleFocusChange) ;
605608
606609 this . #updateState( tree [ 0 ] ) ;
607610
@@ -631,6 +634,7 @@ export class Virtual {
631634 */
632635 async stop ( ) {
633636 this . #disconnectDOMObserver?.( ) ;
637+ this . #container?. removeEventListener ( "focusin" , this . #boundHandleFocusChange) ;
634638 this . #invalidateTreeCache( ) ;
635639
636640 if ( this . #cursor) {
@@ -642,7 +646,7 @@ export class Virtual {
642646 this . #container = null ;
643647 this . #itemTextLog = [ ] ;
644648 this . #spokenPhraseLog = [ ] ;
645-
649+ this . #boundHandleFocusChange = null ;
646650 return ;
647651 }
648652
You can’t perform that action at this time.
0 commit comments