Skip to content

fix(material/slider): unable to assign min/max values if they are more precise than then step #21155

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

Merged
merged 1 commit into from
Dec 4, 2020

Conversation

crisbeto
Copy link
Member

We have some logic that trims the value to the same number of decimals as the step, in order to avoid assigning long decimal values. The problem is that if the min or max are more precise than the step, we round up just above the min or below the max, preventing the user from reaching the end values.

These changes add an exception to the rounding for the min and max values.

Fixes #21147.

@crisbeto crisbeto added P2 The issue is important to a large percentage of users, with a workaround target: patch This PR is targeted for the next patch release labels Nov 26, 2020
@crisbeto crisbeto requested a review from mmalerba as a code owner November 26, 2020 17:26
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 26, 2020
Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…e precise than then step

We have some logic that trims the value to the same number of decimals as the `step`,
in order to avoid assigning long decimal values. The problem is that if the `min` or `max`
are more precise than the `step`, we round up just above the `min` or below the `max`,
preventing the user from reaching the end values.

These changes add an exception to the rounding for the `min` and `max` values.

Fixes angular#21147.
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Dec 1, 2020
@crisbeto crisbeto force-pushed the 21147/slider-min-max-rounding branch from 1df263f to 360c429 Compare December 1, 2020 19:59
@mmalerba mmalerba merged commit e95edad into angular:master Dec 4, 2020
mmalerba pushed a commit that referenced this pull request Dec 4, 2020
…e precise than then step (#21155)

We have some logic that trims the value to the same number of decimals as the `step`,
in order to avoid assigning long decimal values. The problem is that if the `min` or `max`
are more precise than the `step`, we round up just above the `min` or below the `max`,
preventing the user from reaching the end values.

These changes add an exception to the rounding for the `min` and `max` values.

Fixes #21147.

(cherry picked from commit e95edad)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P2 The issue is important to a large percentage of users, with a workaround target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(matSlider): Unable to get min value on dragging
2 participants