File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 128128                    break ; 
129129                case  "enter" :
130130                case  "return" :
131+                     // enter and return have the default browser behavior, 
132+                     // but they also close the menu 
133+                     // this behavior is identical between both the WAI example, and GitHub's 
134+                     setTimeout ( function ( )  { 
135+                         closeMenu ( ) ; 
136+                     } ,  100 ) ; 
137+                     break ; 
131138                case  "space" :
132139                case  " " :
133-                     // enter, return, and space have the default browser behavior, 
134-                     // but they also close the menu 
140+                     // space closes the menu, and activates the current link 
135141                    // this behavior is identical between both the WAI example, and GitHub's 
142+                     if  ( document . activeElement  instanceof  HTMLAnchorElement  &&  ! document . activeElement . hasAttribute ( "aria-haspopup" ) )  { 
143+                         document . activeElement . click ( ) ; 
144+                     } 
136145                    setTimeout ( function ( )  { 
137146                        closeMenu ( ) ; 
138147                    } ,  100 ) ; 
148+                     e . preventDefault ( ) ; 
149+                     e . stopPropagation ( ) ; 
139150                    break ; 
140151                case  "home" :
141152                case  "pageup" :
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments