Replace hardcoded tooltip inset with foundation-token-derived value

This commit is contained in:
2026-05-26 09:12:54 +02:00
parent 44bae893a3
commit edbcc13db4
@@ -474,7 +474,17 @@
} }
const clampedRect = panel.getBoundingClientRect(); const clampedRect = panel.getBoundingClientRect();
const safeInset = 8; const rootStyles = getComputedStyle(document.documentElement);
const spacingSmallRaw = rootStyles.getPropertyValue('--spacing-small').trim();
const rootFontSize = parseFloat(rootStyles.fontSize) || 16;
const spacingSmallValue = parseFloat(spacingSmallRaw);
const safeInset = Number.isNaN(spacingSmallValue)
? 0
: (
spacingSmallRaw.endsWith('rem')
? spacingSmallValue * rootFontSize
: spacingSmallValue
);
let shiftX = 0; let shiftX = 0;
if (clampedRect.right > (viewportWidth - safeInset)) { if (clampedRect.right > (viewportWidth - safeInset)) {