Skip to content

Commit

Permalink
Do not set value if any non numeric symbol entered
Browse files Browse the repository at this point in the history
  • Loading branch information
pkirilin committed Jul 15, 2024
1 parent 433fee8 commit 52c0464
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/frontend/src/shared/lib/inputMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export const mapToNumericInputProps: MapToInputPropsFunction<number, TextFieldPr
helperText,
onChange: event => {
const numValue = Number(event.target.value);
setValue(isNaN(numValue) ? 0 : numValue);

if (!isNaN(numValue)) {
setValue(numValue);
}
},
onFocus: event => {
event.target.select();
Expand Down

0 comments on commit 52c0464

Please sign in to comment.