File tree Expand file tree Collapse file tree 1 file changed +21
-6
lines changed Expand file tree Collapse file tree 1 file changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -557,20 +557,35 @@ function playground_text(playground, hidden = true) {
557557 document . addEventListener ( 'keydown' , function ( e ) {
558558 if ( e . altKey || e . ctrlKey || e . metaKey || e . shiftKey ) { return ; }
559559 if ( window . search && window . search . hasFocus ( ) ) { return ; }
560+ var html = document . querySelector ( 'html' ) ;
560561
562+ function next ( ) {
563+ var nextButton = document . querySelector ( '.nav-chapters.next' ) ;
564+ if ( nextButton ) {
565+ window . location . href = nextButton . href ;
566+ }
567+ }
568+ function prev ( ) {
569+ var previousButton = document . querySelector ( '.nav-chapters.previous' ) ;
570+ if ( previousButton ) {
571+ window . location . href = previousButton . href ;
572+ }
573+ }
561574 switch ( e . key ) {
562575 case 'ArrowRight' :
563576 e . preventDefault ( ) ;
564- var nextButton = document . querySelector ( '.nav-chapters.next' ) ;
565- if ( nextButton ) {
566- window . location . href = nextButton . href ;
577+ if ( html . dir == 'rtl' ) {
578+ prev ( ) ;
579+ } else {
580+ next ( ) ;
567581 }
568582 break ;
569583 case 'ArrowLeft' :
570584 e . preventDefault ( ) ;
571- var previousButton = document . querySelector ( '.nav-chapters.previous' ) ;
572- if ( previousButton ) {
573- window . location . href = previousButton . href ;
585+ if ( html . dir == 'rtl' ) {
586+ next ( ) ;
587+ } else {
588+ prev ( ) ;
574589 }
575590 break ;
576591 }
You can’t perform that action at this time.
0 commit comments