From f8ad641612c37dcbde5c551db83fd3129180a2b8 Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Thu, 22 Feb 2024 16:22:20 +0100 Subject: [PATCH] Fix flipped left/right cursor keys in RTL mode In RTL mode the slider is flipped and goes from right to left. The revisions increase from right to left. The left cursor key needs to be the one that increases the position. Note there are three different "RTL scroll types" called "default", "negative", and "reverse". This is only about CSS positions and doesn't affect the cursor keys. Change-Id: Ie747aa2572f2542b6c2c2176f817dd9a42b29f78 --- modules/ext.RevisionSlider.SliderView.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ext.RevisionSlider.SliderView.js b/modules/ext.RevisionSlider.SliderView.js index 4466e164..b8556a76 100644 --- a/modules/ext.RevisionSlider.SliderView.js +++ b/modules/ext.RevisionSlider.SliderView.js @@ -403,7 +403,7 @@ $.extend( SliderView.prototype, { isNewer = pointer.getView().isNewerPointer(); let offset = 0; - if ( event.which === OO.ui.Keys.RIGHT ) { + if ( event.which === ( this.dir === 'rtl' ? OO.ui.Keys.LEFT : OO.ui.Keys.RIGHT ) ) { offset = 1; if ( isNewer ) { @@ -416,7 +416,7 @@ $.extend( SliderView.prototype, { this.setOlderPointerPos( oldPos + 1 ); } } - } else if ( event.which === OO.ui.Keys.LEFT ) { + } else if ( event.which === ( this.dir === 'rtl' ? OO.ui.Keys.RIGHT : OO.ui.Keys.LEFT ) ) { offset = -1; if ( isNewer ) {