aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-04-19 08:46:47 +0000
committerFuwn <[email protected]>2026-04-19 08:46:47 +0000
commit6865cae76cb88aa78d7c297c637557468fdce8fc (patch)
tree3a36c6d2e9b953b4ee2e2e01bc274ab93bff2818
parentrefactor(wrapped): simplify redundant new Date(Date.now()) calls (diff)
downloaddue.moe-6865cae76cb88aa78d7c297c637557468fdce8fc.tar.xz
due.moe-6865cae76cb88aa78d7c297c637557468fdce8fc.zip
fix(tooltip): park measurement node off-screen to stop body resize
Absolute-positioned tooltips were appended to document.body without initial left/top, so their static-flow position extended body scrollWidth/scrollHeight during layout, briefly enlarging the page on hover.
-rw-r--r--src/lib/Tooltip/LinkedTooltip.svelte3
-rw-r--r--src/lib/Tooltip/tooltip.ts2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/Tooltip/LinkedTooltip.svelte b/src/lib/Tooltip/LinkedTooltip.svelte
index b3fc6ae2..fb4faa4f 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.left = "-9999px";
+ tooltipDiv.style.top = "-9999px";
+ tooltipDiv.style.visibility = "hidden";
tooltipDiv.style.zIndex = "1000";
opacity = 0;
tooltipDiv.style.pointerEvents = "none";
diff --git a/src/lib/Tooltip/tooltip.ts b/src/lib/Tooltip/tooltip.ts
index 5772c33f..488dba5a 100644
--- a/src/lib/Tooltip/tooltip.ts
+++ b/src/lib/Tooltip/tooltip.ts
@@ -14,6 +14,8 @@ const tooltip = (element: HTMLElement) => {
tooltipDiv = document.createElement("div");
tooltipDiv.style.position = "absolute";
+ tooltipDiv.style.left = "-9999px";
+ tooltipDiv.style.top = "-9999px";
tooltipDiv.style.zIndex = "1000";
tooltipDiv.style.opacity = "0";
tooltipDiv.style.transition = `opacity ${tooltipTransitionTime}ms ease-in-out, top 0.3s ease, left 0.3s ease`;