Skip to content

Commit

Permalink
Fixed #2344 - InputNumber doesn't submit a form
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Nov 4, 2021
1 parent 847ea49 commit 4aba799
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/inputnumber/InputNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,14 +521,15 @@ export class InputNumber extends Component {
}

onInputKeyPress(event) {
event.preventDefault();
let code = event.which || event.keyCode;
let char = String.fromCharCode(code);
const isDecimalSign = this.isDecimalSign(char);
const isMinusSign = this.isMinusSign(char);

if ((48 <= code && code <= 57) || isMinusSign || isDecimalSign) {
this.insert(event, char, { isDecimalSign, isMinusSign });

event.preventDefault();
}
}

Expand Down

0 comments on commit 4aba799

Please sign in to comment.