@@ -145,11 +145,19 @@ function ThemeNav () {
145145 // If we found a matching link then reset current and re-apply
146146 // otherwise retain the existing match
147147 if ( link . length > 0 ) {
148- $ ( '.wy-menu-vertical .current' ) . removeClass ( 'current' ) ;
149- link . addClass ( 'current' ) ;
150- link . closest ( 'li.toctree-l1' ) . parent ( ) . addClass ( 'current' ) ;
148+ $ ( '.wy-menu-vertical .current' )
149+ . removeClass ( 'current' )
150+ . attr ( 'aria-expanded' , 'false' ) ;
151+ link . addClass ( 'current' )
152+ . attr ( 'aria-expanded' , 'true' ) ;
153+ link . closest ( 'li.toctree-l1' )
154+ . parent ( )
155+ . addClass ( 'current' )
156+ . attr ( 'aria-expanded' , 'true' ) ;
151157 for ( let i = 1 ; i <= 10 ; i ++ ) {
152- link . closest ( 'li.toctree-l' + i ) . addClass ( 'current' ) ;
158+ link . closest ( 'li.toctree-l' + i )
159+ . addClass ( 'current' )
160+ . attr ( 'aria-expanded' , 'true' ) ;
153161 }
154162 link [ 0 ] . scrollIntoView ( ) ;
155163 }
@@ -188,13 +196,26 @@ function ThemeNav () {
188196
189197 nav . toggleCurrent = function ( elem ) {
190198 var parent_li = elem . closest ( 'li' ) ;
191- parent_li . siblings ( 'li.current' ) . removeClass ( 'current' ) ;
192- parent_li . siblings ( ) . find ( 'li.current' ) . removeClass ( 'current' ) ;
199+ parent_li
200+ . siblings ( 'li.current' )
201+ . removeClass ( 'current' )
202+ . attr ( 'aria-expanded' , 'false' ) ;
203+ parent_li
204+ . siblings ( )
205+ . find ( 'li.current' )
206+ . removeClass ( 'current' )
207+ . attr ( 'aria-expanded' , 'false' ) ;
193208 var children = parent_li . find ( '> ul li' ) ;
194209 // Don't toggle terminal elements.
195210 if ( children . length ) {
196- children . removeClass ( 'current' ) ;
197- parent_li . toggleClass ( 'current' ) ;
211+ children
212+ . removeClass ( 'current' )
213+ . attr ( 'aria-expanded' , 'false' ) ;
214+ parent_li
215+ . toggleClass ( 'current' )
216+ . attr ( 'aria-expanded' , function ( i , old ) {
217+ return old == 'true' ? 'false' : 'true' ;
218+ } ) ;
198219 }
199220 }
200221
0 commit comments