Skip to content

Commit

Permalink
fix(slider ramp): correct handle and ramp vertical alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
cdransf committed Sep 23, 2024
1 parent eaf250d commit 423d759
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-ways-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@spectrum-css/slider": minor
---

This applies a flex layout to the spectrum slider controls to consistently align the enclosed handle and ramp, while also removing the margins that might otherwise interfere with alignment. This aims to resolve the issues with the calc-based approach that exhibited variations in vertical alignment.
5 changes: 2 additions & 3 deletions components/slider/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@
}

.spectrum-Slider-controls {
display: inline-block;
display: flex;
align-items: center;
box-sizing: border-box;
cursor: pointer;
position: relative;
Expand Down Expand Up @@ -284,7 +285,6 @@
}

.spectrum-Slider-ramp {
margin-block-start: calc(var(--mod-slider-ramp-track-height, var(--spectrum-slider-ramp-track-height)) / 2);
block-size: var(--mod-slider-ramp-track-height, var(--spectrum-slider-ramp-track-height));

position: absolute;
Expand All @@ -310,7 +310,6 @@
inline-size: var(--mod-slider-handle-size, var(--spectrum-slider-handle-size));
block-size: var(--mod-slider-handle-size, var(--spectrum-slider-handle-size));

inset-block-start: calc(var(--mod-slider-control-height, var(--spectrum-slider-control-height)) / 2 - var(--mod-slider-handle-size, var(--spectrum-slider-handle-size)) / 2);
margin-block: 0;
margin-inline: calc(var(--mod-slider-handle-size, var(--spectrum-slider-handle-size)) / -2) 0;
border-width: var(--mod-slider-handle-border-width, var(--spectrum-slider-handle-border-width));
Expand Down

0 comments on commit 423d759

Please sign in to comment.