From 271b8f6cbb0b7415495054c2d3129f09b0ea8e37 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 19 Apr 2026 11:08:52 +0000 Subject: fix(tooltip): park off-screen on create, enable glide after first placement The tooltip was appended to body with no top/left, so its static-flow position extended body.scrollWidth/scrollHeight during measurement. Fix by setting initial top/left to -9999px so the node never lands in the flow. Previously this slid the tooltip in from off-screen because the top/left 0.3s transition was already live. Now the transition starts as opacity-only at creation time; after the first updateTooltipPosition snaps into place, a requestAnimationFrame re-enables the top/left easing so subsequent mousemove updates keep the original smooth glide and 100ms debounce behavior. LinkedTooltip's measurement div is parked the same way plus visibility:hidden, since it exists only to read offsetWidth for the Svelte-rendered tooltip. --- src/lib/Tooltip/LinkedTooltip.svelte | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/lib/Tooltip/LinkedTooltip.svelte') diff --git a/src/lib/Tooltip/LinkedTooltip.svelte b/src/lib/Tooltip/LinkedTooltip.svelte index b3fc6ae2..bbf0ffe5 100644 --- a/src/lib/Tooltip/LinkedTooltip.svelte +++ b/src/lib/Tooltip/LinkedTooltip.svelte @@ -36,6 +36,9 @@ const createTooltip = () => { if (!tooltipDiv) { tooltipDiv = document.createElement("div"); tooltipDiv.style.position = "absolute"; + tooltipDiv.style.top = "-9999px"; + tooltipDiv.style.left = "-9999px"; + tooltipDiv.style.visibility = "hidden"; tooltipDiv.style.zIndex = "1000"; opacity = 0; tooltipDiv.style.pointerEvents = "none"; -- cgit v1.2.3