Bug 1546650 - Fix F6 focus switch in address book, test it using Marionette. r=aceman,mkmelin a=jorgk
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Fri, 26 Jul 2019 21:23:06 +0200
changeset 35278 7bb950c0c346f030b452325bd0e68cfd8679cef5
parent 35277 9344b60b89f062d9f49f916aca27b65180ee4f90
child 35279 ae93791896d5c7934a3afc22246d3d94c786b8c6
push id2475
push usermozilla@jorgk.com
push dateFri, 02 Aug 2019 20:07:29 +0000
treeherdercomm-beta@c7b7a4c6679d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman, mkmelin, jorgk
bugs1546650
Bug 1546650 - Fix F6 focus switch in address book, test it using Marionette. r=aceman,mkmelin a=jorgk Differential Revision: https://phabricator.services.mozilla.com/D28645
mail/components/addrbook/content/addressbook.js
--- a/mail/components/addrbook/content/addressbook.js
+++ b/mail/components/addrbook/content/addressbook.js
@@ -557,33 +557,31 @@ function SwitchPaneFocus(event) {
   var dirTree           = GetDirTree();
   var searchInput       = document.getElementById("peopleSearchInput");
 
   if (event && event.shiftKey) {
     if (focusedElement == gAbResultsTree && searchBox) {
       searchInput.focus();
     } else if ((focusedElement == gAbResultsTree || focusedElement == searchBox) && !IsDirPaneCollapsed()) {
       dirTree.focus();
-    } else if (focusedElement != cardViewBox && !IsCardViewAndAbResultsPaneSplitterCollapsed()) {
-      if (cardViewBoxEmail1) {
-        cardViewBoxEmail1.focus();
-      } else {
-        cardViewBox.focus();
-      }
+    } else if (focusedElement != cardViewBox &&
+               !IsCardViewAndAbResultsPaneSplitterCollapsed() &&
+               cardViewBoxEmail1 &&
+               cardViewBoxEmail1.getAttribute("collapsed") != "true") {
+      cardViewBoxEmail1.focus();
     } else {
       gAbResultsTree.focus();
     }
   } else if (focusedElement == searchBox) {
     gAbResultsTree.focus();
-  } else if (focusedElement == gAbResultsTree && !IsCardViewAndAbResultsPaneSplitterCollapsed()) {
-    if (cardViewBoxEmail1) {
-      cardViewBoxEmail1.focus();
-    } else {
-      cardViewBox.focus();
-    }
+  } else if (focusedElement == gAbResultsTree &&
+             !IsCardViewAndAbResultsPaneSplitterCollapsed() &&
+             cardViewBoxEmail1 &&
+             cardViewBoxEmail1.getAttribute("collapsed") != "true") {
+    cardViewBoxEmail1.focus();
   } else if (focusedElement != dirTree && !IsDirPaneCollapsed()) {
     dirTree.focus();
   } else if (searchBox && searchInput) {
     searchInput.focus();
   } else {
     gAbResultsTree.focus();
   }
 }
@@ -632,19 +630,21 @@ function GetCardViewBoxEmail1() {
 
 function IsDirPaneCollapsed() {
   var dirPaneBox = GetDirTree().parentNode;
   return dirPaneBox.getAttribute("collapsed") == "true" ||
          dirPaneBox.getAttribute("hidden") == "true";
 }
 
 function IsCardViewAndAbResultsPaneSplitterCollapsed() {
-  var cardViewBox = document.getElementById("CardViewOuterBox");
+  var cardViewInnerBox = document.getElementById("CardViewInnerBox");
+  var cardViewOuterBox = document.getElementById("CardViewOuterBox");
   try {
-    return (cardViewBox.getAttribute("collapsed") == "true");
+    return (cardViewInnerBox.getAttribute("collapsed") == "true" ||
+            cardViewOuterBox.getAttribute("collapsed") == "true");
   } catch (ex) {
     return false;
   }
 }
 
 function LaunchUrl(url) {
   // Doesn't matter if this bit fails, window.location contains its own prompts
   try {