diff --git a/src/index.tsx b/src/index.tsx index bd60336f..4a844fe9 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -262,7 +262,7 @@ export function generateTrigger( componentWillUnmount() { this.clearDelayTimer(); this.clearOutsideHandler(); - clearTimeout(this.mouseDownTimeout); + this.clearMouseDownTimer(); raf.cancel(this.attachId); } @@ -389,6 +389,7 @@ export function generateTrigger( clearTimeout(this.mouseDownTimeout); this.mouseDownTimeout = window.setTimeout(() => { this.hasPopupMouseDown = false; + this.clearMouseDownTimer(); }, 0); if (this.context) { @@ -666,6 +667,13 @@ export function generateTrigger( } } + clearMouseDownTimer() { + if (this.mouseDownTimeout) { + clearTimeout(this.mouseDownTimeout); + this.mouseDownTimeout = null; + } + } + clearOutsideHandler() { if (this.clickOutsideHandler) { this.clickOutsideHandler.remove();