Skip to content

Commit

Permalink
Changed how the shorthand font is obtained
Browse files Browse the repository at this point in the history
  • Loading branch information
josercarcamo committed Jan 15, 2025
1 parent ba3ee46 commit 0f0c3fd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/calcite-components/src/components/slider/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -987,10 +987,10 @@ export class Slider

if (intersects(minHandleBounds, maxHandleBounds)) {
leftValueLabel.classList.add(CSS.hyphen, CSS.hyphenWrap);
const width = getTextWidth(
leftValueLabel.textContent,
window.getComputedStyle(leftValueLabel)["font"],
);
const computedStyle = getComputedStyle(leftValueLabel);
// we recreate the shorthand vs using computedStyle.font because browsers will return "" instead of the expected value
const shorthandFont = `${computedStyle.fontStyle} ${computedStyle.fontVariant} ${computedStyle.fontWeight} ${computedStyle.fontSize}/${computedStyle.lineHeight} ${computedStyle.fontFamily}`;
const width = getTextWidth(leftValueLabel.textContent, shorthandFont);
leftValueLabel.style.transform = `translateY(-${width / 2 - 4}px) rotate(90deg)`;
} else {
leftValueLabel.classList.remove(CSS.hyphen, CSS.hyphenWrap);
Expand Down

0 comments on commit 0f0c3fd

Please sign in to comment.