From b430def773d2ee2fb027d1798aced0c7566c6ed4 Mon Sep 17 00:00:00 2001 From: Sonali9 Date: Sat, 27 Apr 2019 09:18:44 -0400 Subject: Bug 1151735 - Hide font panel when text is being selected r=Gijs --- toolkit/components/reader/AboutReader.jsm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'toolkit/components/reader') diff --git a/toolkit/components/reader/AboutReader.jsm b/toolkit/components/reader/AboutReader.jsm index 4cc9d6750..5defa623e 100644 --- a/toolkit/components/reader/AboutReader.jsm +++ b/toolkit/components/reader/AboutReader.jsm @@ -58,6 +58,7 @@ var AboutReader = function(win, articlePromise) { this._scrollOffset = win.pageYOffset; + doc.addEventListener("mousedown", this); doc.addEventListener("click", this); win.addEventListener("pagehide", this); @@ -191,13 +192,16 @@ AboutReader.prototype = { if (!aEvent.isTrusted) return; + let target = aEvent.target; switch (aEvent.type) { + case "mousedown": + if (!target.closest(".dropdown-popup")) { + this._closeDropdowns(); + } + break; case "click": - let target = aEvent.target; if (target.classList.contains("dropdown-toggle")) { this._toggleDropdownClicked(aEvent); - } else if (!target.closest(".dropdown-popup")) { - this._closeDropdowns(); } break; case "scroll": -- cgit v1.2.3