Bug 1576601 - Add click listener only to the link in the protections panel info message. r=andreio
☠☠ backed out by 283763664a4b ☠ ☠
authorNihanth Subramanya <nhnt11@gmail.com>
Mon, 30 Sep 2019 10:31:39 +0000
changeset 495632 f8919c0d489cbee7931e33590559c4132463d3da
parent 495631 78bbc490901b64fae7dcb6e07c8b282a5a273231
child 495633 d1fe84998565c0a1f22979b467eb4e21862dc5c0
push id114140
push userdvarga@mozilla.com
push dateWed, 02 Oct 2019 18:04:51 +0000
treeherdermozilla-inbound@32eb0ea893f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersandreio
bugs1576601
milestone71.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 1576601 - Add click listener only to the link in the protections panel info message. r=andreio Differential Revision: https://phabricator.services.mozilla.com/D47445
browser/components/newtab/lib/ToolbarPanelHub.jsm
--- a/browser/components/newtab/lib/ToolbarPanelHub.jsm
+++ b/browser/components/newtab/lib/ToolbarPanelHub.jsm
@@ -325,35 +325,35 @@ class _ToolbarPanelHub {
   _createHeroElement(win, doc, message) {
     const messageEl = this._createElement(doc, "div");
     messageEl.setAttribute("id", "protections-popup-message");
     messageEl.classList.add("whatsNew-hero-message");
     const wrapperEl = this._createElement(doc, "div");
     wrapperEl.classList.add("whatsNew-message-body");
     messageEl.appendChild(wrapperEl);
 
-    this._attachClickListener(win, wrapperEl, message);
-
     wrapperEl.appendChild(
       this._createElement(doc, "h2", {
         classList: "whatsNew-message-title",
         content: message.content.title,
       })
     );
     wrapperEl.appendChild(
       this._createElement(doc, "p", { content: message.content.body })
     );
 
     if (message.content.link_text) {
-      wrapperEl.appendChild(
-        this._createElement(doc, "a", {
-          classList: "text-link",
-          content: message.content.link_text,
-        })
-      );
+      let linkEl = this._createElement(doc, "a", {
+        classList: "text-link",
+        content: message.content.link_text,
+      });
+      wrapperEl.appendChild(linkEl);
+      this._attachClickListener(win, linkEl, message);
+    } else {
+      this._attachClickListener(win, wrapperEl, message);
     }
 
     return messageEl;
   }
 
   _createElement(doc, elem, options = {}) {
     const node = doc.createElementNS("http://www.w3.org/1999/xhtml", elem);
     if (options.classList) {