Replace hardcoded tooltip inset with foundation-token-derived value
This commit is contained in:
@@ -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)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user