@@ -232,14 +232,18 @@ export function Events(Base) {
232232 const  topMargin  =  config ( ) . topMargin ; 
233233 // Use [id='1234'] instead of #id to handle special cases such as reserved characters and pure number id 
234234 // https://stackoverflow.com/questions/37270787/uncaught-syntaxerror-failed-to-execute-queryselector-on-document 
235-  const  section  =  dom . find ( " [id='"   +   id   +   "']" ) ; 
235+  const  section  =  dom . find ( ` [id=" ${ id } "]` ) ; 
236236 section  &&  this . #scrollTo( section ,  topMargin ) ; 
237237
238-  const  li  =  this . #nav[ this . #getNavKey( path ,  id ) ] ; 
239238 const  sidebar  =  dom . getNode ( '.sidebar' ) ; 
240-  const  active  =  dom . find ( sidebar ,  'li.active' ) ; 
241-  active  &&  active . classList . remove ( 'active' ) ; 
242-  li  &&  li . classList . add ( 'active' ) ; 
239+  const  oldActive  =  dom . find ( sidebar ,  'li.active' ) ; 
240+  const  oldPage  =  dom . find ( sidebar ,  `[aria-current]` ) ; 
241+  const  newActive  =  this . #nav[ this . #getNavKey( path ,  id ) ] ; 
242+  const  newPage  =  dom . find ( sidebar ,  `[href$="${ path }  "]` ) ?. parentNode ; 
243+  oldActive ?. classList . remove ( 'active' ) ; 
244+  oldPage ?. removeAttribute ( 'aria-current' ) ; 
245+  newActive ?. classList . add ( 'active' ) ; 
246+  newPage ?. setAttribute ( 'aria-current' ,  'page' ) ; 
243247 } 
244248
245249 #scrollEl =  dom . $ . scrollingElement  ||  dom . $ . documentElement ; 
@@ -257,7 +261,15 @@ export function Events(Base) {
257261 * @void  
258262 */ 
259263 #btn( el )  { 
260-  const  toggle  =  _  =>  dom . body . classList . toggle ( 'close' ) ; 
264+  const  toggle  =  _  =>  { 
265+  dom . body . classList . toggle ( 'close' ) ; 
266+ 
267+  const  isClosed  =  isMobile 
268+  ? dom . body . classList . contains ( 'close' ) 
269+  : ! dom . body . classList . contains ( 'close' ) ; 
270+ 
271+  el . setAttribute ( 'aria-expanded' ,  isClosed ) ; 
272+  } ; 
261273
262274 el  =  dom . getNode ( el ) ; 
263275 if  ( el  ===  null  ||  el  ===  undefined )  { 
@@ -342,8 +354,10 @@ export function Events(Base) {
342354 if  ( hash . indexOf ( href )  ===  0  &&  ! target )  { 
343355 target  =  a ; 
344356 dom . toggleClass ( node ,  'add' ,  'active' ) ; 
357+  node . setAttribute ( 'aria-current' ,  'page' ) ; 
345358 }  else  { 
346359 dom . toggleClass ( node ,  'remove' ,  'active' ) ; 
360+  node . removeAttribute ( 'aria-current' ) ; 
347361 } 
348362 } ) ; 
349363
0 commit comments