Bug 1374784 - Unable to use keyboard to navigate cookies r?gl draft
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Tue, 27 Jun 2017 10:50:23 -0700
changeset 600715 ed75bbe5f09222d0d3fa62a8125a61aa7fe0f3af
parent 600616 f4e52135d9bdc6ce98bb37b450021445aed894ce
child 635080 0a3c9ba6bb6a2d5f309cfed3ec89b1c1931e8289
push id65856
push userbmo:mratcliffe@mozilla.com
push dateTue, 27 Jun 2017 19:51:12 +0000
reviewersgl
bugs1374784
milestone56.0a1
Bug 1374784 - Unable to use keyboard to navigate cookies r?gl MozReview-Commit-ID: 8x2xCE6T3Ye
devtools/client/shared/widgets/TableWidget.js
devtools/client/storage/test/browser_storage_cookies_edit_keyboard.js
--- a/devtools/client/shared/widgets/TableWidget.js
+++ b/devtools/client/shared/widgets/TableWidget.js
@@ -185,28 +185,46 @@ TableWidget.prototype = {
   get selectedIndex() {
     return this.columns.get(this.uniqueId).selectedIndex;
   },
 
   /**
    * Returns the index of the selected row disregarding hidden rows.
    */
   get visibleSelectedIndex() {
-    let cells = this.columns.get(this.uniqueId).visibleCellNodes;
+    let column = this.firstVisibleColumn;
+    let cells = column.visibleCellNodes;
 
     for (let i = 0; i < cells.length; i++) {
       if (cells[i].classList.contains("theme-selected")) {
         return i;
       }
     }
 
     return -1;
   },
 
   /**
+   * Returns the first visible column.
+   */
+  get firstVisibleColumn() {
+    for (let column of this.columns.values()) {
+      if (column._private) {
+        continue;
+      }
+
+      if (column.column.clientHeight > 0) {
+        return column;
+      }
+    }
+
+    return null;
+  },
+
+  /**
    * returns all editable columns.
    */
   get editableColumns() {
     let filter = columns => {
       columns = [...columns].filter(col => {
         if (col.clientWidth === 0) {
           return false;
         }
--- a/devtools/client/storage/test/browser_storage_cookies_edit_keyboard.js
+++ b/devtools/client/storage/test/browser_storage_cookies_edit_keyboard.js
@@ -4,16 +4,17 @@
 
 // Basic test to check the editing of cookies with the keyboard.
 
 "use strict";
 
 add_task(function* () {
   yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html");
   showAllColumns(true);
+  showColumn("uniqueKey", false);
 
   let id = getCookieId("test4", "test1.example.org", "/browser");
   yield startCellEdit(id, "name");
   yield typeWithTerminator("test6", "VK_TAB");
   yield typeWithTerminator(".example.org", "VK_TAB");
   yield typeWithTerminator("/", "VK_TAB");
   yield typeWithTerminator("Tue, 25 Dec 2040 12:00:00 GMT", "VK_TAB");
   yield typeWithTerminator("test6value", "VK_TAB");