From 51259c7b8b10eefb3e60e07e3624e777b7ae22c4 Mon Sep 17 00:00:00 2001 From: Elvin Chu Date: Tue, 30 Mar 2021 03:00:06 +0800 Subject: [PATCH] Fix tippy position incorrect after resize or screen (#996) A fix for: When the user scrolled or resize the tooltip position didn't update --- examples/Components/Routes/Suggestions/index.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/Components/Routes/Suggestions/index.vue b/examples/Components/Routes/Suggestions/index.vue index 2e86371e..fe087e16 100644 --- a/examples/Components/Routes/Suggestions/index.vue +++ b/examples/Components/Routes/Suggestions/index.vue @@ -224,8 +224,7 @@ export default { // renders a popup with suggestions // tiptap provides a virtualNode object for using popper.js (or tippy.js) for popups renderPopup(node) { - const boundingClientRect = node.getBoundingClientRect() - const { x, y } = boundingClientRect + const { x, y } = node.getBoundingClientRect(); if (x === 0 && y === 0) { return @@ -237,7 +236,7 @@ export default { // ref: https://atomiks.github.io/tippyjs/v6/all-props/ this.popup = tippy('.page', { - getReferenceClientRect: () => boundingClientRect, + getReferenceClientRect: () => node.getBoundingClientRect(), appendTo: () => document.body, interactive: true, sticky: true, // make sure position of tippy is updated when content changes