fix(elastic-slider): drag handle teleporting to the label end#109
Merged
Conversation
The fill tile's min-width clamp (label end + 24px, "tile never collapses behind the label") made the handle RENDER at the end of the label text at low values while the pointer→value mapping stayed full-track linear — so grabbing the handle where you see it teleported the value to ~the middle of the range. Adopt the upstream @ncdai/elastic-slider model: fill width ≡ value percent, no clamp, render position always equals value position. The fill may now collapse behind the label; the handle fades there instead (upstream's two-sided label/value dodge). Keeps the Figma styling, the allowAuto left slot, dot snap stops, and endIcon.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
On the customize-sidebar slider rows, grabbing the handle at a low value teleported the value toward the middle of the range ("snaps to the closest point next to the end of the label text").
Root cause: the fill tile had a min-width clamp (label end + 24px — "tile never collapses behind the label") so the handle rendered at the end of the label text, while the pointer→value mapping stayed full-track linear. Visual position and value disagreed, so grabbing the handle where you see it jumped the value.
Fix
Adopt the upstream @ncdai/elastic-slider interaction model: fill width ≡ value percent, no clamp — render position always equals value position, so drag is 1:1 with the cursor.
allowAutoleft slot, dot snap stops, andendIconVerification
tsc, oxlint, oxfmt, vitest, knip all green (pre-commit + pre-push hooks)