From 12b580eb208b4a136bb70c304d1d55180fa56344 Mon Sep 17 00:00:00 2001 From: Carbon Copy Date: Thu, 1 Aug 2019 08:20:50 +1000 Subject: [PATCH] Fix #532: Add referenceNode property for followCursor Note: this will exist in popper.js@1.16.0 which hasn't released yet --- src/createTippy.ts | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/createTippy.ts b/src/createTippy.ts index 993ba5c6f..632c3b7be 100644 --- a/src/createTippy.ts +++ b/src/createTippy.ts @@ -435,6 +435,9 @@ export default function createTippy( if (isCursorOverReference || !instance.props.interactive) { instance.popperInstance!.reference = { ...instance.popperInstance!.reference, + // This will exist in next Popper.js feature release to fix #532 + // @ts-ignore + referenceNode: reference, // These `client` values don't get used by Popper.js if they are 0 clientWidth: 0, clientHeight: 0, @@ -1067,17 +1070,20 @@ export default function createTippy( setTransitionDuration(transitionableElements, duration) setVisibilityState(transitionableElements, 'visible') - onTransitionedIn(duration, (): void => { - if (instance.props.aria) { - getEventListenersTarget().setAttribute( - `aria-${instance.props.aria}`, - popper.id, - ) - } + onTransitionedIn( + duration, + (): void => { + if (instance.props.aria) { + getEventListenersTarget().setAttribute( + `aria-${instance.props.aria}`, + popper.id, + ) + } - instance.props.onShown(instance) - instance.state.isShown = true - }) + instance.props.onShown(instance) + instance.state.isShown = true + }, + ) } mount()