From 216e775829529a2748b3ab993609edcfa85288d3 Mon Sep 17 00:00:00 2001 From: flyingrub Date: Wed, 23 Aug 2017 16:40:12 +0200 Subject: [PATCH] Bug 1392403 - Ease the dismiss of the popup in about:telemetry r=chutten Fix ping selector popup is sometimes hard to dismiss. MozReview-Commit-ID: KEFcmq6cvRA --HG-- extra : rebase_source : e2a6b13bd7f355aa88e47c50347d03aee5f0fa57 --- toolkit/content/aboutTelemetry.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/toolkit/content/aboutTelemetry.js b/toolkit/content/aboutTelemetry.js index c8ae5827a0fe..5093b4d7dfa6 100644 --- a/toolkit/content/aboutTelemetry.js +++ b/toolkit/content/aboutTelemetry.js @@ -321,19 +321,29 @@ var PingPicker = { document.getElementById("older-ping") .addEventListener("click", () => this._movePingIndex(1)); + let pingPickerNeedHide = false; + let pingPicker = document.getElementById("ping-picker"); + pingPicker.addEventListener("mouseenter", () => pingPickerNeedHide = false); + pingPicker.addEventListener("mouseleave", () => pingPickerNeedHide = true); document.addEventListener("click", (ev) => { - if (ev.target.querySelector("#ping-picker")) { - document.getElementById("ping-picker").classList.add("hidden"); + if (pingPickerNeedHide) { + pingPicker.classList.add("hidden"); } }); document.getElementById("choose-payload") .addEventListener("change", () => displayPingData(gPingData)); document.getElementById("processes") .addEventListener("change", () => displayPingData(gPingData)); - Array.from(document.querySelectorAll(".change-ping")).forEach(el => - el.addEventListener("click", () => - document.getElementById("ping-picker").classList.remove("hidden")) - ); + Array.from(document.querySelectorAll(".change-ping")).forEach(el => { + el.addEventListener("click", (event) => { + if (!pingPicker.classList.contains("hidden")) { + pingPicker.classList.add("hidden"); + } else { + pingPicker.classList.remove("hidden") + event.stopPropagation(); + } + }); + }); }, onPingSourceChanged() {