Bug 1490366 - Part 3: Select the first item in richlistbox on focus r=dao
authorMark Striemer <mstriemer@mozilla.com>
Sun, 14 Oct 2018 19:20:16 +0000
changeset 489522 0a45a5634cf18f31b1ab848f4c71b34cabe80ec5
parent 489521 cb62a8b8a525d7442d53ee6441fe3f60608b0160
child 489523 4420c564868c8e9e9e7b0330d96430a7901192e0
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersdao
bugs1490366
milestone64.0a1
Bug 1490366 - Part 3: Select the first item in richlistbox on focus r=dao Differential Revision: https://phabricator.services.mozilla.com/D8282
toolkit/content/widgets/richlistbox.xml
--- a/toolkit/content/widgets/richlistbox.xml
+++ b/toolkit/content/widgets/richlistbox.xml
@@ -883,16 +883,20 @@
         ]]>
       </handler>
 
       <handler event="focus">
         <![CDATA[
           if (this.getRowCount() > 0) {
             if (this.currentIndex == -1) {
               this.currentIndex = this.getIndexOfFirstVisibleRow();
+              let currentItem = this.getItemAtIndex(this.currentIndex);
+              if (currentItem) {
+                this.selectItem(currentItem);
+              }
             } else {
               this.currentItem._fireEvent("DOMMenuItemActive");
             }
           }
           this._lastKeyTime = 0;
         ]]>
       </handler>