Slider: update --slider-bar-width
to use 2*var(--slider-size)
#7464
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
My goal is to make a RangedSlider that looks something like this:
So after messing around a bit I ended up with the following props:
However, by default, the
bar
component of the slider is not placed at equal distances from both of the thumbs, so it looks horrible:After playing around in firefox's css inspector for a bit, I was able to figure out that changing the
--slider-bar-width
property of themantine-Slider-bar
div as such fixed the issue:This makes sense in my head; First the bar's offset is set to the correct left side unfilled percentage, but then its subtracted by
--slider-size
for some padding (I assume). Now, after the width of the bar is set to the exact filled percentage, the right side is behind the correct placement by exactly--slider-size
, and thus needs to be extended by2*var(--slider-size)
to match the appearance of the left side.I've also been able to implement this fix in a slightly-hacky way using the Styles API:
I've verified extremely briefly that it doesn't break regular sliders, but I haven't tested much else at all (I'm doing this solely in the github UI, I merely guessed where the right place to put this is). Apologies, I just don't really have much time atm.
Please feel free to close this if I'm completely wrong about this problem and have a better idea for a solution. I've only just started using this library like yesterday, so I wouldn't be surprised :) Thanks everyone for your work and help!