diff --git a/src/addons/Portal/Portal.js b/src/addons/Portal/Portal.js
index 4f49874189..eeac3f9710 100644
--- a/src/addons/Portal/Portal.js
+++ b/src/addons/Portal/Portal.js
@@ -215,7 +215,7 @@ function Portal(props) {
}
const handleTriggerMouseLeave = (e, ...rest) => {
- clearTimeout(mouseEnterTimer)
+ clearTimeout(mouseEnterTimer.current)
// Call original event handler
_.invoke(trigger, 'props.onMouseLeave', e, ...rest)
@@ -229,7 +229,7 @@ function Portal(props) {
}
const handleTriggerMouseEnter = (e, ...rest) => {
- clearTimeout(mouseLeaveTimer)
+ clearTimeout(mouseLeaveTimer.current)
// Call original event handler
_.invoke(trigger, 'props.onMouseEnter', e, ...rest)
diff --git a/test/specs/addons/Portal/Portal-test.js b/test/specs/addons/Portal/Portal-test.js
index 05cf68a1ae..9d6900b1b2 100644
--- a/test/specs/addons/Portal/Portal-test.js
+++ b/test/specs/addons/Portal/Portal-test.js
@@ -7,6 +7,7 @@ import * as common from 'test/specs/commonTests'
import { domEvent, sandbox } from 'test/utils'
import Portal from 'src/addons/Portal/Portal'
import PortalInner from 'src/addons/Portal/PortalInner'
+import wait from 'test/utils/wait'
let wrapper
@@ -371,6 +372,38 @@ describe('Portal', () => {
done()
}, 1)
})
+
+ /**
+ * e--l--d--v
+ * ^: mouseenter
+ * ^: BEFORE_DELAY: mouseleave
+ * ^: expected DELAY
+ * ^: final validation
+ */
+ it('does not open the portal when leave before delay', async () => {
+ const DELAY = 20
+ const BEFORE_DELAY = 10
+
+ wrapperMount(
+