From 4f8169aab56a6f2859aff157434bc8992cec03af Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Thu, 2 Mar 2023 20:31:47 +0000 Subject: [PATCH] tippy: Add comment justifying `parent` as `appendTo` default. --- web/src/tippyjs.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/src/tippyjs.js b/web/src/tippyjs.js index 1e2c74d8c6..445d94794b 100644 --- a/web/src/tippyjs.js +++ b/web/src/tippyjs.js @@ -82,8 +82,12 @@ tippy.setDefaultProps({ // Create the tooltip inside the parent element. This has the // undesirable side effect of CSS properties of the parent elements // applying to tooltips, which causes ugly clipping if the parent - // element has overflow rules. We override this in many specific - // tooltips, and may want to change the default. + // element has overflow rules. Even with that, we prefer to have + // tooltips appended to the parent so that the tooltip gets removed + // if the parent is hidden / removed from DOM; which is not the case + // with appending it to `body` which has side effect of tooltips + // sticking around due to browser not communicating to tippy that + // the element has been removed without having a Mutation Observer. appendTo: "parent", // To add a text tooltip, override this by setting data-tippy-content. // To add an HTML tooltip, set data-tooltip-template-id to the id of a