-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
bug(mat-slider): Max value not updating correctly when new value is 0 #23913
Comments
Confirmed that the ticks do not update after setting the max to zero. This actually happens both in the current and MDC-based slider (which is impressive because they're completely different implementations). |
Hi! Is anybody working on it? Otherwise I could try to fix it if you don’t mind |
@DMezhenskyi Feel free to send a PR |
@DMezhenskyi PLZ Let me know, if you are still going to work on this issue and I'll close my PR :) |
Apologize for so many closed PRs had some troubles with source control. |
Hi @lukonik! If this fix is urgent then I do not mind if your solution eventually will be merged. My fix is ready, however, I can deliver my PR in about 3 weeks when I get back from vacation. P.s from what I remember in my solution, besides the case you covered in your PR, there is also a method _updateTickIntervalPercent where happens division by zero if min and max values are the same. If it happens, the result of the calculation will be “Infinity” which is not a valid CSS value for the tick’s background-size property, so it is also a cause of wrongly repainted ticks. |
Hey, thx for your reply. |
…4218) * fix(material/slider): Ticks updated wrongly if the max property changed to 0 When we get equal min & max value for the slider then we can get division by zero which leads to an improper style value for the background-size (Infinity%). This fix introduces a tiny function that checks if we deal with finite numbers during calculations where potentially division by zero may occur. Fixes #23913 * fix(material/slider): Check if interval persentage a valid number Fixes #23913 (cherry picked from commit c1f25bc)
…4218) * fix(material/slider): Ticks updated wrongly if the max property changed to 0 When we get equal min & max value for the slider then we can get division by zero which leads to an improper style value for the background-size (Infinity%). This fix introduces a tiny function that checks if we deal with finite numbers during calculations where potentially division by zero may occur. Fixes #23913 * fix(material/slider): Check if interval persentage a valid number Fixes #23913
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…gular#24218) * fix(material/slider): Ticks updated wrongly if the max property changed to 0 When we get equal min & max value for the slider then we can get division by zero which leads to an improper style value for the background-size (Infinity%). This fix introduces a tiny function that checks if we deal with finite numbers during calculations where potentially division by zero may occur. Fixes angular#23913 * fix(material/slider): Check if interval persentage a valid number Fixes angular#23913
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I am changing slider's max value in my component while/after doing some works. And it seems it has a problem updating visually when new max value is 0.
Reproduction
Steps to reproduce:
<mat-slider min="0" [displayWith]="displayValue" [max]="maxValue" step="1" [thumbLabel]="true" [tickInterval]="1" [(ngModel)]="sliderValue" (ngModelChange)="changeSliderValue()"></mat-slider>
Expected Behavior
Updating slider and ticks correctly.
Actual Behavior
Updated slider and ticks incorrectly.
Environment
The text was updated successfully, but these errors were encountered: