You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Normalizer function does not replace values when normalized value is ''. E.g. When normalizer function strips out numbers, putting in numbers in an input does not empty out the input.
To Reproduce
Steps to reproduce the behavior:
Case 1:
Set normalizer method to a function that removes numbers
normalizer: value => {
const pattern = new RegExp("[^ A-Za-z'-]", 'gi');
return value.replace(pattern, '');
}
In the input with the normalizer, type in any numbers. E.g. 23434
Case 2:
Same step as Case 1
In the input, type in any letters and then numbers. E.g. Sdf234
Expected behavior
Input should clear the numbers and display normalized input.
Actual Behavior
Case 1: input does not clear numbers ❌
Case 2: Works as intended; input clears out numbers and leaves letters. ✅
// Only change the value if it's different from the normalized one.
if (normalizedValue && normalizedValue !== field.value) {
field.value = normalizedValue;
}
Since normalizedValue is empty, the if statement is not being returned as a true statement
The text was updated successfully, but these errors were encountered:
Describe the bug
Normalizer function does not replace values when normalized value is
''
. E.g. When normalizer function strips out numbers, putting in numbers in an input does not empty out the input.To Reproduce
Steps to reproduce the behavior:
Case 1:
normalizer
method to a function that removes numbers23434
Case 2:
Sdf234
Expected behavior
Input should clear the numbers and display normalized input.
Actual Behavior
Case 1: input does not clear numbers ❌
Case 2: Works as intended; input clears out numbers and leaves letters. ✅
Screenshots
Case 1
Case 2
Environment:
Tested on Mac Chrome
Additional context
Line 121-124 is probably the culprit here
Since
normalizedValue
is empty, the if statement is not being returned as a true statementThe text was updated successfully, but these errors were encountered: