Bug 1546997 - Expand add-on card with single click r=jaws
authorMark Striemer <mstriemer@mozilla.com>
Sat, 11 May 2019 03:12:18 +0000
changeset 532422 3fc09d5a4f225b2164b2a4ade0c2b1545f999903
parent 532421 7a303f34b6ce2df1f444b031cc947c01117bc0eb
child 532423 395e27a912b3b6aea3c27ccdb8a0028c23abf223
push id11268
push usercsabou@mozilla.com
push dateTue, 14 May 2019 15:24:22 +0000
treeherdermozilla-beta@5fb7fcd568d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1546997
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1546997 - Expand add-on card with single click r=jaws These originally changed to double click with the HTML version but it was decided to stick with the single click and hover styles from the XUL version. Differential Revision: https://phabricator.services.mozilla.com/D30740
toolkit/mozapps/extensions/content/aboutaddons.css
toolkit/mozapps/extensions/content/aboutaddons.js
toolkit/mozapps/extensions/test/browser/browser_html_detail_view.js
toolkit/mozapps/extensions/test/browser/browser_html_updates.js
--- a/toolkit/mozapps/extensions/content/aboutaddons.css
+++ b/toolkit/mozapps/extensions/content/aboutaddons.css
@@ -42,16 +42,21 @@ addon-list message-bar-stack.pending-uni
 .addon.card {
   margin-bottom: 16px;
 }
 
 .addon.card:hover {
   box-shadow: var(--card-shadow);
 }
 
+addon-card:not([expanded]) > .addon.card:hover {
+  box-shadow: var(--card-shadow-hover);
+  cursor: pointer;
+}
+
 .addon-card-collapsed {
   display: flex;
 }
 
 addon-list .addon.card {
   -moz-user-select: none;
 }
 
--- a/toolkit/mozapps/extensions/content/aboutaddons.js
+++ b/toolkit/mozapps/extensions/content/aboutaddons.js
@@ -958,16 +958,23 @@ class AddonCard extends HTMLElement {
           if (e.mozInputSource == MouseEvent.MOZ_SOURCE_KEYBOARD) {
             this.panel.toggle(e);
           }
           break;
         case "report":
           this.panel.hide();
           openAbuseReport({addonId: addon.id, reportEntryPoint: "menu"});
           break;
+        default:
+          // Handle a click on the card itself.
+          // Don't expand if expanded or a button was clicked.
+          if (!this.expanded && e.target.localName != "button") {
+            loadViewFn("detail", this.addon.id);
+          }
+          break;
       }
     } else if (e.type == "change") {
       let {name} = e.target;
       if (name == "autoupdate") {
         addon.applyBackgroundUpdates = e.target.value;
       } else if (name == "private-browsing") {
         let policy = WebExtensionPolicy.getByID(addon.id);
         let extension = policy && policy.extension;
@@ -990,39 +997,32 @@ class AddonCard extends HTMLElement {
           this.update();
         }
       }
     } else if (e.type == "mousedown") {
       // Open panel on mousedown when the mouse is used.
       if (action == "more-options") {
         this.panel.toggle(e);
       }
-    } else if (e.type == "dblclick") {
-      // Don't expand if expanded or a button is double clicked.
-      if (!this.expanded && e.target.tagName != "BUTTON") {
-        loadViewFn("detail", this.addon.id);
-      }
     }
   }
 
   get panel() {
     return this.card.querySelector("panel-list");
   }
 
   registerListeners() {
     this.addEventListener("change", this);
     this.addEventListener("click", this);
-    this.addEventListener("dblclick", this);
     this.addEventListener("mousedown", this);
   }
 
   removeListeners() {
     this.removeEventListener("change", this);
     this.removeEventListener("click", this);
-    this.removeEventListener("dblclick", this);
     this.removeEventListener("mousedown", this);
   }
 
   onNewInstall(install) {
     this.updateInstall = install;
     this.sendEvent("update-found");
   }
 
--- a/toolkit/mozapps/extensions/test/browser/browser_html_detail_view.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_html_detail_view.js
@@ -123,22 +123,21 @@ add_task(async function testOpenDetailVi
     useAddonManager: "temporary",
   });
 
   await extension.startup();
 
   let win = await loadInitialView("extension");
   let doc = win.document;
 
-  // Test double click on card to open details.
+  // Test click on card to open details.
   let card = getAddonCard(doc, "test@mochi.test");
   ok(!card.querySelector("addon-details"), "The card doesn't have details");
   let loaded = waitForViewLoad(win);
   EventUtils.synthesizeMouseAtCenter(card, {clickCount: 1}, win);
-  EventUtils.synthesizeMouseAtCenter(card, {clickCount: 2}, win);
   await loaded;
 
   card = getAddonCard(doc, "test@mochi.test");
   ok(card.querySelector("addon-details"), "The card now has details");
 
   loaded = waitForViewLoad(win);
   win.managerWindow.document.getElementById("go-back").click();
   await loaded;
@@ -169,17 +168,16 @@ add_task(async function testDetailOperat
 
   let win = await loadInitialView("extension");
   let doc = win.document;
 
   let card = getAddonCard(doc, "test@mochi.test");
   ok(!card.querySelector("addon-details"), "The card doesn't have details");
   let loaded = waitForViewLoad(win);
   EventUtils.synthesizeMouseAtCenter(card, {clickCount: 1}, win);
-  EventUtils.synthesizeMouseAtCenter(card, {clickCount: 2}, win);
   await loaded;
 
   card = getAddonCard(doc, "test@mochi.test");
   let panel = card.querySelector("panel-list");
 
   // Check button visibility.
   let disableButton = panel.querySelector('[action="toggle-disabled"]');
   ok(!disableButton.hidden, "The disable button is visible");
--- a/toolkit/mozapps/extensions/test/browser/browser_html_updates.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_html_updates.js
@@ -11,17 +11,16 @@ add_task(async function enableHtmlViews(
   });
 });
 
 function loadDetailView(win, id) {
   let doc = win.document;
   let card = doc.querySelector(`addon-card[addon-id="${id}"]`);
   let loaded = waitForViewLoad(win);
   EventUtils.synthesizeMouseAtCenter(card, {clickCount: 1}, win);
-  EventUtils.synthesizeMouseAtCenter(card, {clickCount: 2}, win);
   return loaded;
 }
 
 add_task(async function testChangeAutoUpdates() {
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       name: "Test",
       applications: {gecko: {id: "test@mochi.test"}},