Skip to content

fix(slider): keep release values within current bounds - #2045

Open
Xapollon430 wants to merge 2 commits into
varletjs:devfrom
Xapollon430:fix/slider-release-current-bounds
Open

Xapollon430 wants to merge 2 commits into
varletjs:devfrom
Xapollon430:fix/slider-release-current-bounds

Conversation

@Xapollon430

@Xapollon430 Xapollon430 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Change information

Slider can emit an out-of-range end value when its bounds change during a drag. Drag to 85 with max 100, change max to 60, then release without another move. The current code emits 85. Changing min can also shift the stored step count into a different numeric value at release.

Keep the latest numeric value for the active thumb and apply the existing precision/bounds helper at release. In range mode, combine it with the latest controlled value of the inactive thumb and clamp both entries. A value that remains within the new bounds stays unchanged.

Checklist

  • Fix linting errors
  • Tests have been added / updated

New regressions cover scalar and range bounds changes, preservation of a valid value after min changes, and a controlled update to the inactive thumb. All 26 Slider tests pass with this change. Scoped lint and formatting checks pass. GitHub CI test and build jobs pass on the final commit.

Commands, run with Node 24.14.1 from packages/varlet-ui:

pnpm exec vp test run --config ../varlet-cli/src/node/config/vitest.config.ts --dir src/slider --maxWorkers 1

Related links

Regression tests

Manual reproduction: bind modelValue and max to refs, set max to 60 after a delay from start, drag past 60 before the delay expires, hold still, then release. end should report 60.

@vercel

vercel Bot commented Nov 25, 2026

Copy link
Copy Markdown

@Xapollon430 is attempting to deploy a commit to the varletjs Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new

pkg-pr-new Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@varlet/cli

npm i https://pkg.pr.new/@varlet/cli@2045

@varlet/icons

npm i https://pkg.pr.new/@varlet/icons@2045

@varlet/import-resolver

npm i https://pkg.pr.new/@varlet/import-resolver@2045

@varlet/preset-tailwindcss

npm i https://pkg.pr.new/@varlet/preset-tailwindcss@2045

@varlet/preset-unocss

npm i https://pkg.pr.new/@varlet/preset-unocss@2045

@varlet/shared

npm i https://pkg.pr.new/@varlet/shared@2045

@varlet/touch-emulator

npm i https://pkg.pr.new/@varlet/touch-emulator@2045

@varlet/ui

npm i https://pkg.pr.new/@varlet/ui@2045

@varlet/use

npm i https://pkg.pr.new/@varlet/use@2045

@varlet/vite-plugins

npm i https://pkg.pr.new/@varlet/vite-plugins@2045

commit: bddadb5

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant