-
-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix slider jumps to first value if value is not in stepsArray #626
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #626 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 1 1
Lines 950 951 +1
=====================================
+ Hits 950 951 +1
Continue to review full report at Codecov.
|
if (step === modelValue) { | ||
var lastStep = i > 0 ? this.options.stepsArray[i - 1] : 0; | ||
|
||
if (step === modelValue || (modelValue > lastStep && modelValue < step)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some context require here, will you add comments here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a stepsArray is given in the options and the value is set from the outside to a value that is not part of the stepsArray, currently the slider will jump to the first element in the stepsArray. I changed it so that if the value is between two values the slider jumps to the higher value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this feature. However, could you add a test case for it?
I also run into this issue when the ceil is not in the step interval the ceil could be overshot. |
I think we just need to respect |
As I used the slider with a stepsArray and an input to change the value, I found that if a value is entered in the input that's not in the stepsArray the slider jumps to its minimum value.
I changed it so that it jumps to the next higher value instead.