Bug 1490366 - Part 3: Select the first item in richlistbox on focus r=dao
☠☠ backed out by 45299a26e20a ☠ ☠
authorMark Striemer <mstriemer@mozilla.com>
Sun, 14 Oct 2018 15:13:52 +0000
changeset 489507 0b8bcd97f254e6db8a023deae4d5e2647c87e30c
parent 489506 4486727805723d44387702ce85f25abbeb8937cf
child 489508 556f31a5e2230d5d06c23b5316d2231a74713251
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>