Skip to content

Commit

Permalink
Fix primefaces#6324: InputNumber allowing accent/dead characters
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Apr 9, 2024
1 parent b48c0dc commit bd14abc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion components/lib/inputnumber/InputNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit bd14abc

Please sign in to comment.