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

fix(number-field): negative numbers handled #3673

Merged
merged 9 commits into from
Sep 29, 2023
3 changes: 3 additions & 0 deletions packages/number-field/src/NumberField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ export class NumberField extends TextfieldBase {
}

private validateInput(value: number): number {
const signMultiplier = value < 0 ? -1 : 1;
value *= signMultiplier;
Rajdeepc marked this conversation as resolved.
Show resolved Hide resolved
if (typeof this.min !== 'undefined') {
value = Math.max(this.min, value);
}
Expand All @@ -489,6 +491,7 @@ export class NumberField extends TextfieldBase {
}
}
}
value *= signMultiplier;
Rajdeepc marked this conversation as resolved.
Show resolved Hide resolved
return value;
}

Expand Down