Bug 1374784 - Unable to use keyboard to navigate cookies r?gl
Keyboard navigation was broken because we introduced private columns that are never displayed (for compound primary keys) and were not equipped to deal with hidden key columns.
This change gets the first visible column, whether it is private or not so that we no longer have to worry about hidden key columns.
The small change to the keyboard test ensures that the private column is hidden so the test will fail if this feature is broken again.
MozReview-Commit-ID: IB7efHsflGU
--- a/devtools/client/shared/widgets/TableWidget.js
+++ b/devtools/client/shared/widgets/TableWidget.js
@@ -180,28 +180,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");