File tree 1 file changed +21
-6
lines changed
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) {
557
557
document . addEventListener ( 'keydown' , function ( e ) {
558
558
if ( e . altKey || e . ctrlKey || e . metaKey || e . shiftKey ) { return ; }
559
559
if ( window . search && window . search . hasFocus ( ) ) { return ; }
560
+ var html = document . querySelector ( 'html' ) ;
560
561
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
+ }
561
574
switch ( e . key ) {
562
575
case 'ArrowRight' :
563
576
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 ( ) ;
567
581
}
568
582
break ;
569
583
case 'ArrowLeft' :
570
584
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 ( ) ;
574
589
}
575
590
break ;
576
591
}
You can’t perform that action at this time.
0 commit comments