Bug 1297473 - Check for first tab in synced tabs sidebar before assigning tabindex. r=markh
authorEdouard Oger <eoger@fastmail.com>
Tue, 23 Aug 2016 11:11:29 -0700
changeset 341691 95fd00fdd5444265256493e7f1c2eef31fc6493d
parent 341681 3cc6bb7fb81eaa8e47183a04f5662114a3113242
child 341692 4e9b9e217312cbff683fd5ac2402eb58c5c370ec
push id5
push userfmarier@mozilla.com
push dateFri, 26 Aug 2016 00:45:46 +0000
reviewersmarkh
bugs1297473
milestone51.0a1
Bug 1297473 - Check for first tab in synced tabs sidebar before assigning tabindex. r=markh MozReview-Commit-ID: 9FkT0HpoB8r
browser/components/syncedtabs/TabListView.js
--- a/browser/components/syncedtabs/TabListView.js
+++ b/browser/components/syncedtabs/TabListView.js
@@ -91,17 +91,20 @@ TabListView.prototype = {
     for (let client of state.clients) {
       if (state.filter) {
         this._renderFilteredClient(client);
       } else {
         this._renderClient(client);
       }
     }
     if (this.list.firstChild) {
-      this.list.firstChild.querySelector(".item.tab:first-child .item-title").setAttribute("tabindex", 2);
+      const firstTab = this.list.firstChild.querySelector(".item.tab:first-child .item-title");
+      if (firstTab) {
+        firstTab.setAttribute("tabindex", 2);
+      }
     }
   },
 
   destroy() {
     this._teardownContextMenu();
     this.container.remove();
   },