From d52d4799c222075b9fa3635f0e6aaa46f300c50f Mon Sep 17 00:00:00 2001 From: Carlos Lopez Jr Date: Fri, 21 Jul 2023 15:23:37 -0400 Subject: [PATCH] tooltiptrigger: don't wait for timeout 0 --- mixins/TooltipTriggerMixin.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mixins/TooltipTriggerMixin.js b/mixins/TooltipTriggerMixin.js index c2102a9d..ce1a688f 100644 --- a/mixins/TooltipTriggerMixin.js +++ b/mixins/TooltipTriggerMixin.js @@ -93,10 +93,8 @@ export default function TooltipTriggerMixin(Base) { /** @param {'mouse'|'touch'|'keyboard'} type */ scheduleShowTooltip(type) { - if (this._tooltipClone.open) { - // console.log('abort schedule (shown)'); - return; - } + if (this._tooltipClone.open) return; + let timeout = 0; switch (type) { case 'mouse': @@ -107,12 +105,14 @@ export default function TooltipTriggerMixin(Base) { break; default: } - // console.log('schedule tooltiptimer'); + clearTimeout(this._idleDebounce); - this._idleDebounce = setTimeout(() => { - // console.log('idle'); - this.showTooltip(type === 'touch'); - }, timeout); + const job = () => this.showTooltip(type === 'touch'); + if (timeout) { + this._idleDebounce = setTimeout(job, timeout); + } else { + job(); + } }, showTooltip(touch = false) {