From 08308678ec8e32e2cd86705345f7c4bbf23db600 Mon Sep 17 00:00:00 2001 From: Melloware Date: Mon, 29 Apr 2024 08:56:35 -0400 Subject: [PATCH] Fix #6324: InputNumber allowing accent/dead characters (#6352) --- 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) => {