igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

igx-slider - slider comes to not work well after changing maxValue.

Open tkiryu opened this issue 8 years ago • 6 comments

Description

slider comes to not work well after changing maxValue.

Steps to reproduce

  1. Go to https://stackblitz.com/edit/igx-slider-issue
  2. At first, max value is 10. Drag a slider and move to the right end.
  3. Then, click a "Change MaxValue to 100" button so that max value is changed to 100.
  4. Drag the slider and move back to the left then move to the right end again.

Result

At step 4, I can't move slider to the right end.

Expected result

Slider should work well even if after changing maxValue.

tkiryu avatar Apr 05 '18 09:04 tkiryu

It seems the upperBound property is not updated with the new maxValue.

I guess we can make it to automatically react on maxValue changes but in that case we risk overwriting user data passed to the upperBound input itself.

@kdinev your thoughts on this?

rkaraivanov avatar Apr 05 '18 10:04 rkaraivanov

@rkaraivanov I think the upperBound should be adjusted if the maxValue changes and exceeds the upperBound. However, currently, if maxValue is set programmatically, then upper bound can also be set, so it's not like currently the same is not achievable.

Question: Can maxValue change from somewhere else other than an API call?

kdinev avatar Apr 05 '18 10:04 kdinev

I suggest checking upperBound/lowerBound when the component is initialized. If they are undefined, then we can make upperBound/lowerBound change whenever maxValue/minValue change. Otherwise, we simply assume that the user is responsible for updating upperBound/lowerBound accordingly.

@kdinev, @rkaraivanov what would you say?

SAndreeva avatar May 08 '18 07:05 SAndreeva

@SAndreeva We should make the upperBound to not be set to maxValue internally if the user doesn't set it. Otherwise if the user has set it, we shouldn't touch it.

kdinev avatar May 08 '18 14:05 kdinev

Unfortunately this approach will break some other logic, therefore some more refactoring will be needed.

SAndreeva avatar May 08 '18 15:05 SAndreeva

I have implemented a fix, based on my suggestion above. Slider behaves as expected and all tests are passing. Shall we apply that fix?

SAndreeva avatar May 10 '18 15:05 SAndreeva