diff --git a/toolkit/mozapps/extensions/content/aboutaddons.js b/toolkit/mozapps/extensions/content/aboutaddons.js index db3fcfcc7845..1ce45dcfec49 100644 --- a/toolkit/mozapps/extensions/content/aboutaddons.js +++ b/toolkit/mozapps/extensions/content/aboutaddons.js @@ -2937,6 +2937,7 @@ class AddonCard extends HTMLElement { !this.expanded && (e.target === this.addonNameEl || !e.target.closest("a")) ) { + e.preventDefault(); loadViewFn(`detail/${this.addon.id}`); } else if ( e.target.localName == "a" && diff --git a/toolkit/mozapps/extensions/test/browser/browser_html_detail_view.js b/toolkit/mozapps/extensions/test/browser/browser_html_detail_view.js index 73736aa686c7..b0989bdf9627 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_html_detail_view.js +++ b/toolkit/mozapps/extensions/test/browser/browser_html_detail_view.js @@ -252,6 +252,18 @@ add_task(async function testOpenDetailView() { card.querySelector('[action="expand"]').click(); await loaded; + await goBack(win); + + // Test click on add-on name. + card = getAddonCard(doc, id2); + ok(!card.querySelector("addon-details"), "The card isn't expanded"); + let addonName = card.querySelector(".addon-name"); + loaded = waitForViewLoad(win); + EventUtils.synthesizeMouseAtCenter(addonName, {}, win); + await loaded; + card = getAddonCard(doc, id2); + ok(card.querySelector("addon-details"), "The card is expanded"); + await closeView(win); await extension.unload(); await extension2.unload(); @@ -281,6 +293,14 @@ add_task(async function testOpenDetailView() { "detail", { type: "extension", addonId: id2 }, ], + ["addonsManager", "view", "aboutAddons", "list", { type: "extension" }], + [ + "addonsManager", + "view", + "aboutAddons", + "detail", + { type: "extension", addonId: id2 }, + ], ]); });