Bug 1538575: Toolbar keyboard navigation: Make arrow keys behave as expected for RTL locales. r=Gijs a=pascalc
authorJames Teh <jteh@mozilla.com>
Tue, 26 Mar 2019 10:35:21 +0000
changeset 525914 2255b45c876b29f68c819f3c3192e35adda4c2f2
parent 525913 3d09581de20a15d906b7d1a47caf17a3cd253a7b
child 525915 05ff90a05c327b29880226f7221387e1ca2cc1ce
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, pascalc
bugs1538575
milestone67.0
Bug 1538575: Toolbar keyboard navigation: Make arrow keys behave as expected for RTL locales. r=Gijs a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D24841
browser/base/content/browser-toolbarKeyNav.js
--- a/browser/base/content/browser-toolbarKeyNav.js
+++ b/browser/base/content/browser-toolbarKeyNav.js
@@ -180,20 +180,22 @@ ToolbarKeyboardNavigator = {
     let focus = document.activeElement;
     if (aEvent.altKey || aEvent.controlKey || aEvent.metaKey ||
         aEvent.shiftKey || !this._isButton(focus)) {
       return;
     }
 
     switch (aEvent.key) {
       case "ArrowLeft":
-        this.navigateButtons(aEvent.currentTarget, true);
+        // Previous if UI is LTR, next if UI is RTL.
+        this.navigateButtons(aEvent.currentTarget, !window.RTL_UI);
         break;
       case "ArrowRight":
-        this.navigateButtons(aEvent.currentTarget, false);
+        // Previous if UI is RTL, next if UI is LTR.
+        this.navigateButtons(aEvent.currentTarget, window.RTL_UI);
         break;
       default:
         return;
     }
     aEvent.preventDefault();
   },
 
   _onKeyPress(aEvent) {