From 44c0a5e1d8905e551a529ae40da67d30eb4fee98 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Mon, 29 Mar 2021 13:27:00 +0300 Subject: [PATCH] Fixed #1912 - InputNumber with required attribute doesn't behave the same as html element. --- src/components/inputnumber/InputNumber.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/inputnumber/InputNumber.js b/src/components/inputnumber/InputNumber.js index 5f3a6b2ecc..89d908cdf2 100644 --- a/src/components/inputnumber/InputNumber.js +++ b/src/components/inputnumber/InputNumber.js @@ -820,8 +820,13 @@ export class InputNumber extends Component { } updateInputValue(newValue) { - this.inputEl.value = this.formatValue(newValue); - this.inputEl.setAttribute('aria-valuenow', newValue); + const value = this.inputEl.value; + const formattedValue = this.formatValue(newValue); + + if (value !== formattedValue) { + this.inputEl.value = formattedValue; + this.inputEl.setAttribute('aria-valuenow', newValue); + } } updateModel(event, value) {