From 53784b2485b300ecb22f00788cb89eb0e5850f25 Mon Sep 17 00:00:00 2001 From: mitchthorson Date: Mon, 30 Dec 2024 16:20:54 -0500 Subject: [PATCH 1/2] Fix: tooltip check if ancestor is element Tooltip would throw error when compiled inside web component without checking. --- src/lib/Tooltip/Tooltip.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Tooltip/Tooltip.svelte b/src/lib/Tooltip/Tooltip.svelte index b0ebf381..4bbf86de 100644 --- a/src/lib/Tooltip/Tooltip.svelte +++ b/src/lib/Tooltip/Tooltip.svelte @@ -155,7 +155,7 @@ if (!el) return; // traverse the tree upwards to see if there are any absolutely, fixed or relatively positioned ancestors let ancestor = el.parentNode; - while (ancestor && ancestor !== document.documentElement) { + while (ancestor && ancestor !== document.documentElement && ancestor instanceof Element) { const position = window.getComputedStyle(ancestor).position; if (position === "relative" || position === "absolute" || position === "fixed") { return ancestor; From e35aa2f5166786a914410597756aabfe1462c52e Mon Sep 17 00:00:00 2001 From: mitchthorson Date: Mon, 30 Dec 2024 16:23:15 -0500 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 142e2a21..d6a01829 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # @UrbanInstitute/dataviz-components Changelog ## Next +- Fix: Tooltip checks if ancestor is an instance of Element before calling getComputedStyle ## v0.12.2 - Fix: Color scale resets ticks when switching from threshold scale to continuous scale