Repository navigation
[slider] Fix keyboard floating-point rounding - #4548
Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codex Review (GPT-5.4)Dominant type: 1. Remaining Bugs / Issues (None)Previous Review Issues StatusThe latest inline review note about fractional Root Cause & Patch AssessmentThe original keyboard fix was correct in scope, and this follow-up closes a separate rounding gap in the shared slider step helper. Using the maximum precision of Test Coverage AssessmentCoverage is now stronger in the exact area raised by review.
That looks sufficient for this PR’s current scope. RecommendationApprove ✅ I do not see any remaining branch-specific issues in the current patch. The latest follow-up addresses the inline review concern directly and adds targeted coverage for it. |
There was a problem hiding this comment.
| return Number(nearest.toFixed(Math.max(getDecimalPrecision(step), getDecimalPrecision(min)))); |
Not directly related, but while testing this I noticed that <Slider min={0.25} step={0.1} defaultValue={0.35} max={1} /> doesn't work, unlike NumberField. This should fix it
Fixes #4547
This keeps keyboard-driven slider updates aligned with the configured step when working with fractional values. Arrow key and page key interactions now normalize their computed value before clamping, matching the existing pointer behavior.
Changes