From bd14abc38500d4bb8e9da3401d29f4068fe80dba Mon Sep 17 00:00:00 2001 From: melloware Date: Tue, 9 Apr 2024 11:02:29 -0400 Subject: [PATCH] Fix #6324: InputNumber allowing accent/dead characters --- components/lib/inputnumber/InputNumber.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/components/lib/inputnumber/InputNumber.js b/components/lib/inputnumber/InputNumber.js index 33a7abb9b7..a6f06b68be 100644 --- a/components/lib/inputnumber/InputNumber.js +++ b/components/lib/inputnumber/InputNumber.js @@ -313,9 +313,19 @@ export const InputNumber = React.memo( if (isSpecialChar.current) { event.target.value = lastValue.current; + isSpecialChar.current = false; } - isSpecialChar.current = false; + if (DomHandler.isAndroid()) { + return; + } + + // #6324 Chrome is allowing accent-dead characters through... + const inputType = event.nativeEvent.inputType; + const data = event.nativeEvent.data; + if (inputType === 'insertText' && /\D/.test(data)) { + event.target.value = lastValue.current; + } }; const onInputAndroidKey = (event) => {