Bug 1509488 - Use keydown handler instead of <key> for Shift+Ctrl+Tab. r=jaws
authorDão Gottwald <dao@mozilla.com>
Mon, 26 Nov 2018 16:07:07 +0000
changeset 507387 40310bdbb6708f03fd171eb194abb09d7e02f72b
parent 507386 8b1f88d7bfeb1949060170ba51b6530db5e93c8e
child 507388 895fcf304c2a19969e8d075457a7cee36ea06895
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1509488
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1509488 - Use keydown handler instead of <key> for Shift+Ctrl+Tab. r=jaws Differential Revision: https://phabricator.services.mozilla.com/D12744
browser/base/content/browser-ctrlTab.js
browser/base/content/browser-sets.inc
--- a/browser/base/content/browser-ctrlTab.js
+++ b/browser/base/content/browser-ctrlTab.js
@@ -425,35 +425,40 @@ var ctrlTab = {
     for (let preview of this.previews) {
       this.updatePreview(preview, null);
     }
   },
 
   onKeyDown(event) {
     if (event.keyCode != event.DOM_VK_TAB ||
         !event.ctrlKey ||
-        !this.isOpen && event.shiftKey ||
         event.altKey ||
         event.metaKey) {
       return;
     }
 
     event.preventDefault();
     event.stopPropagation();
 
     if (this.isOpen) {
       this.advanceFocus(!event.shiftKey);
-    } else {
-      let tabs = gBrowser.visibleTabs;
-      if (tabs.length > 2) {
-        this.open();
-      } else if (tabs.length == 2) {
-        let index = tabs[0].selected ? 1 : 0;
-        gBrowser.selectedTab = tabs[index];
-      }
+      return;
+    }
+
+    if (event.shiftKey) {
+      this.showAllTabs();
+      return;
+    }
+
+    let tabs = gBrowser.visibleTabs;
+    if (tabs.length > 2) {
+      this.open();
+    } else if (tabs.length == 2) {
+      let index = tabs[0].selected ? 1 : 0;
+      gBrowser.selectedTab = tabs[index];
     }
   },
 
   onKeyPress(event) {
     if (!this.isOpen ||
         !event.ctrlKey) {
       return;
     }
@@ -588,18 +593,10 @@ var ctrlTab = {
       PageThumbs.addExpirationFilter(this);
     else
       PageThumbs.removeExpirationFilter(this);
 
     // If we're not running, hide the "Show All Tabs" menu item,
     // as Shift+Ctrl+Tab will be handled by the tab bar.
     document.getElementById("menu_showAllTabs").hidden = !enable;
     document.getElementById("menu_viewPopup")[toggleEventListener]("popupshowing", this);
-
-    // Also disable the <key> to ensure Shift+Ctrl+Tab never triggers
-    // Show All Tabs.
-    var key_showAllTabs = document.getElementById("key_showAllTabs");
-    if (enable)
-      key_showAllTabs.removeAttribute("disabled");
-    else
-      key_showAllTabs.setAttribute("disabled", "true");
   },
 };
--- a/browser/base/content/browser-sets.inc
+++ b/browser/base/content/browser-sets.inc
@@ -262,17 +262,17 @@
     <key id="key_fullZoomReduce"  key="&fullZoomReduceCmd.commandkey;"   command="cmd_fullZoomReduce"  modifiers="accel"/>
     <key                          key="&fullZoomReduceCmd.commandkey2;"  command="cmd_fullZoomReduce"  modifiers="accel"/>
     <key id="key_fullZoomEnlarge" key="&fullZoomEnlargeCmd.commandkey;"  command="cmd_fullZoomEnlarge" modifiers="accel"/>
     <key                          key="&fullZoomEnlargeCmd.commandkey2;" command="cmd_fullZoomEnlarge" modifiers="accel"/>
     <key                          key="&fullZoomEnlargeCmd.commandkey3;" command="cmd_fullZoomEnlarge" modifiers="accel"/>
     <key id="key_fullZoomReset"   key="&fullZoomResetCmd.commandkey;"    command="cmd_fullZoomReset"   modifiers="accel"/>
     <key                          key="&fullZoomResetCmd.commandkey2;"   command="cmd_fullZoomReset"   modifiers="accel"/>
 
-    <key id="key_showAllTabs" command="Browser:ShowAllTabs" keycode="VK_TAB" modifiers="control,shift" disabled="true"/>
+    <key id="key_showAllTabs" keycode="VK_TAB" modifiers="control,shift"/>
 
     <key id="key_switchTextDirection" key="&bidiSwitchTextDirectionItem.commandkey;" command="cmd_switchTextDirection" modifiers="accel,shift" />
 
     <key id="key_privatebrowsing" command="Tools:PrivateBrowsing" key="&privateBrowsingCmd.commandkey;"
          modifiers="accel,shift" reserved="true"/>
     <key id="key_sanitize" command="Tools:Sanitize" keycode="VK_DELETE" modifiers="accel,shift"/>
 #ifdef XP_MACOSX
     <key id="key_sanitize_mac" command="Tools:Sanitize" keycode="VK_BACK" modifiers="accel,shift"/>