Skip to content

Commit 54c3f11

Browse files
committed
feat(slider): fix range slider
1 parent c2f3c0b commit 54c3f11

File tree

2 files changed

+3
-31
lines changed

2 files changed

+3
-31
lines changed

.changeset/rude-jokes-judge.md

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,6 @@
44

55
# Slider: offset variant track fix
66

7-
The border radius styles were not being applied to the second instance of the `spectrum-Slider-track` when the offset variant is activated. The reason for this bug is because when the `offset` is selected, the template structure changes as `spectrum-Slider-fill` gets added to the slider. This likely negated the initial declaration of the border radius styles written below:
8-
9-
```css
10-
.spectrum-Slider-track {
11-
&:first-of-type {
12-
&::before {
13-
border-start-start-radius: var(
14-
--mod-slider-track-corner-radius,
15-
var(--spectrum-slider-track-corner-radius)
16-
);
17-
border-end-start-radius: var(
18-
--mod-slider-track-corner-radius,
19-
var(--spectrum-slider-track-corner-radius)
20-
);
21-
}
22-
}
23-
24-
&:last-of-type {
25-
&::before {
26-
border-start-end-radius: var(
27-
--mod-slider-track-corner-radius,
28-
var(--spectrum-slider-track-corner-radius)
29-
);
30-
border-end-end-radius: var(
31-
--mod-slider-track-corner-radius,
32-
var(--spectrum-slider-track-corner-radius)
33-
);
34-
}
35-
}
36-
}
37-
```
7+
The border radius styles were not being applied to the second instance of the `spectrum-Slider-track` when the offset variant is activated. The reason for this bug is because when the `offset` is selected, the template structure changes as `spectrum-Slider-fill` gets added to the slider.
388

399
Adding a sibling combinator `&~.spectrum-Slider-track` to `spectrum-Slider-track` when offset is activated resolved the issue.

components/slider/index.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,8 @@
627627
.spectrum-Slider-track {
628628
&:not(:first-of-type, :last-of-type)::before {
629629
background: var(--highcontrast-slider-filled-track-fill-color, var(--mod-slider-track-fill-color, var(--spectrum-slider-track-fill-color)));
630+
border-start-end-radius: 0;
631+
border-end-end-radius: 0;
630632
}
631633
}
632634
}

0 commit comments

Comments
 (0)