Bug 1513149 - Hovering the action buttons doesn't display the command associated with the button. r=Gijs, a=RyanVM
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Tue, 11 Dec 2018 18:27:01 +0000
changeset 509110 4195e37ecbe5026d45fff1660bd5b37fc3241c7b
parent 509109 7fce298d99a171adb79d268edf88f9dd4fda8dca
child 509111 6da52487092a73ee4e2164c07abc2bb7f850319e
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, RyanVM
bugs1513149
milestone65.0
Bug 1513149 - Hovering the action buttons doesn't display the command associated with the button. r=Gijs, a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D14172
browser/components/downloads/content/downloads.js
--- a/browser/components/downloads/content/downloads.js
+++ b/browser/components/downloads/content/downloads.js
@@ -819,40 +819,45 @@ var DownloadsView = {
     DownloadsCommon.log("Context menu has hidden.");
     this.contextMenuOpen = false;
   },
 
   /**
    * Mouse listeners to handle selection on hover.
    */
   onDownloadMouseOver(aEvent) {
-    if (aEvent.originalTarget.classList.contains("downloadButton")) {
-      aEvent.target.classList.add("downloadHoveringButton");
+    let item = aEvent.target.closest("richlistitem,richlistbox");
+    if (item.localName != "richlistitem") {
+      return;
     }
-    if (!(this.contextMenuOpen || this.subViewOpen) &&
-        aEvent.target.parentNode == this.richListBox) {
-      this.richListBox.selectedItem = aEvent.target;
+
+    if (aEvent.target.classList.contains("downloadButton")) {
+      item.classList.add("downloadHoveringButton");
+    }
+
+    if (!this.contextMenuOpen && !this.subViewOpen) {
+      this.richListBox.selectedItem = item;
     }
   },
 
   onDownloadMouseOut(aEvent) {
-    if (aEvent.originalTarget.classList.contains("downloadButton")) {
-      aEvent.target.classList.remove("downloadHoveringButton");
+    let item = aEvent.target.closest("richlistitem,richlistbox");
+    if (item.localName != "richlistitem") {
+      return;
     }
-    if (!(this.contextMenuOpen || this.subViewOpen) &&
-        aEvent.target.parentNode == this.richListBox) {
-      // If the destination element is outside of the richlistitem, clear the
-      // selection.
-      let element = aEvent.relatedTarget;
-      while (element && element != aEvent.target) {
-        element = element.parentNode;
-      }
-      if (!element) {
-        this.richListBox.selectedIndex = -1;
-      }
+
+    if (aEvent.target.classList.contains("downloadButton")) {
+      item.classList.remove("downloadHoveringButton");
+    }
+
+    // If the destination element is outside of the richlistitem, clear the
+    // selection.
+    if (!this.contextMenuOpen && !this.subViewOpen &&
+        !item.contains(aEvent.relatedTarget)) {
+      this.richListBox.selectedIndex = -1;
     }
   },
 
   onDownloadContextMenu(aEvent) {
     let element = this.richListBox.selectedItem;
     if (!element) {
       return;
     }