Bug 1374784 - Unable to use keyboard to navigate cookies r?gl
MozReview-Commit-ID: 8x2xCE6T3Ye
--- 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");