File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 128
128
break ;
129
129
case "enter" :
130
130
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 ;
131
138
case "space" :
132
139
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
135
141
// 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
+ }
136
145
setTimeout ( function ( ) {
137
146
closeMenu ( ) ;
138
147
} , 100 ) ;
148
+ e . preventDefault ( ) ;
149
+ e . stopPropagation ( ) ;
139
150
break ;
140
151
case "home" :
141
152
case "pageup" :
You can’t perform that action at this time.
0 commit comments