File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,10 @@ export class FocusTrap {
2727  get  enabled ( ) : boolean  {  return  this . _enabled ;  } 
2828  set  enabled ( val : boolean )  { 
2929    this . _enabled  =  val ; 
30-     this . _startAnchor . tabIndex  =  this . _endAnchor . tabIndex  =  this . _enabled  ? 0  : - 1 ; 
30+ 
31+     if  ( this . _startAnchor  &&  this . _endAnchor )  { 
32+       this . _startAnchor . tabIndex  =  this . _endAnchor . tabIndex  =  this . _enabled  ? 0  : - 1 ; 
33+     } 
3134  } 
3235  private  _enabled : boolean  =  true ; 
3336
@@ -44,11 +47,11 @@ export class FocusTrap {
4447
4548  /** Destroys the focus trap by cleaning up the anchors. */ 
4649  destroy ( )  { 
47-     if  ( this . _startAnchor . parentNode )  { 
50+     if  ( this . _startAnchor   &&   this . _startAnchor . parentNode )  { 
4851      this . _startAnchor . parentNode . removeChild ( this . _startAnchor ) ; 
4952    } 
5053
51-     if  ( this . _endAnchor . parentNode )  { 
54+     if  ( this . _endAnchor   &&   this . _endAnchor . parentNode )  { 
5255      this . _endAnchor . parentNode . removeChild ( this . _endAnchor ) ; 
5356    } 
5457
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments