Skip to content
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

Prevent setting value over max and under min limit #304

Closed
wants to merge 1 commit into from

Conversation

samiheikki
Copy link
Contributor

@samiheikki samiheikki commented Jan 21, 2019

Fixes "Typing 3, then 2 will result in invalid appearance for a number field with max of 31"


This change is Reviewable

@@ -209,6 +209,12 @@
}

__onInputChange() {
if (this.min && this.value < this.min) {
Copy link
Member

Choose a reason for hiding this comment

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

these two conditions will likely fail for this.min === 0 and this.max === 0
please use more strict assertion, e.g. !isNaN(this.min)

@tomivirkki
Copy link
Member

Ah, the idea wasn't to automatically fix the value but to prevent the field from going invalid while the user is typing. This occurred during UX tests but can't seem to be able to reproduce now. @web-padawan let's close this PR if this isn't reproducible

@tomivirkki
Copy link
Member

Apparently this was because preventInvalidInput was also enabled for the field for UX. In that case the behaviour is as expected. Closing.

@tomivirkki tomivirkki closed this Jan 23, 2019
@samiheikki samiheikki deleted the fix/number-field-min-max-validation branch January 23, 2019 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants