Skip to content

Commit

Permalink
Fixed #5545 - InputNumber Not Working android
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Apr 24, 2024
1 parent 6004166 commit 1d9c036
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions components/lib/inputnumber/InputNumber.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:aria-valuemin="min"
:aria-valuemax="max"
:aria-valuenow="modelValue"
:inputmode="mode === 'decimal' && !minFractionDigits ? 'numeric' : 'decimal'"
:disabled="disabled"
:readonly="readonly"
:placeholder="placeholder"
Expand All @@ -18,6 +19,7 @@
:aria-invalid="invalid || undefined"
@input="onUserInput"
@keydown="onInputKeyDown"
@keypress="onInputKeyPress"
@paste="onPaste"
@click="onInputClick"
@focus="onInputFocus"
Expand Down Expand Up @@ -525,21 +527,24 @@ export default {
break;
default:
if (this.readonly) {
return;
}
event.preventDefault();
break;
}
},
onInputKeyPress(event) {
if (this.readonly) {
return;
}
let char = event.key;
const isDecimalSign = this.isDecimalSign(char);
const isMinusSign = this.isMinusSign(char);
let char = event.key;
let isDecimalSign = this.isDecimalSign(char);
const isMinusSign = this.isMinusSign(char);
if ((Number(char) >= 0 && Number(char) <= 9) || isMinusSign || isDecimalSign) {
this.insert(event, char, { isDecimalSign, isMinusSign });
}
if (event.code !== 'Enter') {
event.preventDefault();
}
break;
if ((Number(char) >= 0 && Number(char) <= 9) || isMinusSign || isDecimalSign) {
this.insert(event, char, { isDecimalSign, isMinusSign });
}
},
onPaste(event) {
Expand Down

0 comments on commit 1d9c036

Please sign in to comment.