Bug 1162750 - Reader View tour tool tip cannot be dismissed by clicking outside the door hanger. r?MattN,past
MozReview-Commit-ID: 6ymh8F3KTMq
--- a/browser/base/content/browser-trackingprotection.js
+++ b/browser/base/content/browser-trackingprotection.js
@@ -229,11 +229,12 @@ var TrackingProtection = {
let panelTarget = yield UITour.getTarget(window, "trackingProtection");
UITour.initForBrowser(gBrowser.selectedBrowser, window);
UITour.showInfo(window, panelTarget,
gNavigatorBundle.getString("trackingProtection.intro.title"),
gNavigatorBundle.getFormattedString("trackingProtection.intro.description2",
[brandShortName]),
undefined, buttons,
- { closeButtonCallback: () => this.dontShowIntroPanelAgain() });
+ { closeButtonCallback: () => this.dontShowIntroPanelAgain(),
+ autohide: true });
}),
};
--- a/browser/components/uitour/UITour.jsm
+++ b/browser/components/uitour/UITour.jsm
@@ -1487,16 +1487,17 @@ this.UITour = {
* @param {Node} aAnchor
* @param {String} [aTitle=""]
* @param {String} [aDescription=""]
* @param {String} [aIconURL=""]
* @param {Object[]} [aButtons=[]]
* @param {Object} [aOptions={}]
* @param {String} [aOptions.closeButtonCallback]
* @param {String} [aOptions.targetCallback]
+ * @param {Boolean} [aOptions.autohide]
*/
showInfo(aChromeWindow, aAnchor, aTitle = "", aDescription = "",
aIconURL = "", aButtons = [], aOptions = {}) {
function showInfoPanel(aAnchorEl) {
aAnchorEl.focus();
let document = aChromeWindow.document;
let tooltip = document.getElementById("UITourTooltip");
@@ -1562,24 +1563,34 @@ this.UITour = {
type: event.type,
};
aOptions.targetCallback(details);
};
if (aOptions.targetCallback && aAnchor.addTargetListener) {
aAnchor.addTargetListener(document, targetCallback);
}
+ if (aOptions.autohide) {
+ tooltip.removeAttribute("noautohide");
+ }
+
tooltip.addEventListener("popuphiding", function tooltipHiding(event) {
tooltip.removeEventListener("popuphiding", tooltipHiding);
tooltipClose.removeEventListener("command", closeButtonCallback);
if (aOptions.targetCallback && aAnchor.removeTargetListener) {
aAnchor.removeTargetListener(document, targetCallback);
}
});
+ tooltip.addEventListener("popuphidden", function tooltipHidden(event) {
+ tooltip.removeEventListener("popuphidden", tooltipHidden);
+ // noautohide attribute may have been removed by options.autohide
+ tooltip.setAttribute("noautohide", "true");
+ });
+
tooltip.setAttribute("targetName", aAnchor.targetName);
tooltip.hidden = false;
let alignment = "bottomcenter topright";
if (aAnchor.infoPanelPosition) {
alignment = aAnchor.infoPanelPosition;
}
let { infoPanelOffsetX: xOffset, infoPanelOffsetY: yOffset } = aAnchor;
--- a/browser/modules/ReaderParent.jsm
+++ b/browser/modules/ReaderParent.jsm
@@ -187,17 +187,17 @@ var ReaderParent = {
if (win.devicePixelRatio > 1) {
icon += "reader-tour@2x.png";
} else {
icon += "reader-tour.png";
}
UITour.showInfo(win, target,
browserBundle.GetStringFromName("readingList.promo.firstUse.readerView.title"),
browserBundle.GetStringFromName("readingList.promo.firstUse.readerView.body"),
- icon);
+ icon, undefined, {autohide: true});
});
},
/**
* Gets an article for a given URL. This method will download and parse a document.
*
* @param url The article URL.
* @param browser The browser where the article is currently loaded.