From a9be9798e01786f678d566a9f70f6836f9a1e3cd Mon Sep 17 00:00:00 2001 From: EnderDev Date: Thu, 15 Feb 2024 20:27:30 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=AD=20Add=20tooltipopen=20attribute=20?= =?UTF-8?q?to=20tooltip=20opener=20nodes=20when=20a=20tooltip=20begins=20s?= =?UTF-8?q?howing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- actors/DotTooltipListenerChild.sys.mjs | 35 +++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/actors/DotTooltipListenerChild.sys.mjs b/actors/DotTooltipListenerChild.sys.mjs index 5c5389c519..4f9dc7dc70 100644 --- a/actors/DotTooltipListenerChild.sys.mjs +++ b/actors/DotTooltipListenerChild.sys.mjs @@ -152,6 +152,13 @@ export class DotTooltipListenerChild extends JSWindowActorChild { Services.els.removeSystemEventListener(doc, "mouseup", this, true); Services.els.removeSystemEventListener(doc, "keydown", this, true); + Services.els.removeSystemEventListener( + this._currentTooltip, + "popupshowing", + this, + false + ); + Services.els.removeSystemEventListener( this._currentTooltip, "popuphiding", @@ -159,6 +166,8 @@ export class DotTooltipListenerChild extends JSWindowActorChild { false ); + this._currentTriggerNode.removeAttribute("tooltipopen"); + this.killTooltipTimer(); this._currentTooltip = null; @@ -353,6 +362,13 @@ export class DotTooltipListenerChild extends JSWindowActorChild { triggerNode || event.target ); + Services.els.addSystemEventListener( + tooltip, + "popupshowing", + this, + false + ); + Services.els.addSystemEventListener( tooltip, "popuphiding", @@ -383,7 +399,7 @@ export class DotTooltipListenerChild extends JSWindowActorChild { this._currentTriggerNode, tooltipAnchor, 0, - -kTooltipMouseTopMargin, + 0, false, false, event @@ -507,6 +523,18 @@ export class DotTooltipListenerChild extends JSWindowActorChild { } } + /** + * Fired when the tooltip starts showing + */ + onTooltipShowing() { + if (!this._currentTooltip) return; + + this._currentTriggerNode.setAttribute( + "tooltipopen", + this._currentTooltip.id || "" + ); + } + /** * Adds tooltip support to a node * @param {Node} node @@ -549,6 +577,11 @@ export class DotTooltipListenerChild extends JSWindowActorChild { return; } + if (event.type == "popupshowing") { + this.onTooltipShowing(); + return; + } + if (event.type == "popuphiding") { this.destroyTooltip(); return;