-
Notifications
You must be signed in to change notification settings - Fork 24
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
NumberField: setting min enables validation for step #420
Comments
Another way to fix this: set |
setting the min or max property should not trigger step-based validation fix #420
setting the min or max property should not trigger step-based validation fix #420
setting the min or max property should not trigger step-based validation fix #420
setting the min or max property should not trigger step-based validation fix #420
setting the min or max property should not trigger step-based validation fix #420
Steps to reproduce:
<vaadin-number-field>
without any attributes/properties1.5
(notice that the field is valid)min=0
for the fieldExpected outcome: the field is still valid
Actual outcome: the field becomes invalid
When the step is not explicitly set by user, it's used just for the plus and minus buttons, but not for validation. Setting the step property enables the step-based validation, but it's unexpected that setting a min-constraint does the same.
These lines reveal the issue:
vaadin-text-field/src/vaadin-number-field.html
Lines 345 to 347 in 7599194
I suggest that instead of asking the native input element to validate the field, add the trivial implementation of min/max-validation here. Only if the step has changed, validate via the native input.
Another problem is that setting
step=1
doesn't trigger the step-based validation, butstep="1"
does. This logic should be based on whether user has set the property, not based on its absolute value.The text was updated successfully, but these errors were encountered: