When using the Phone International field on a Drupal 11.2 site, the phone input does not allow entering numbers.
Each digit typed into the field is immediately cleared, as if pressing the delete key.
Steps to reproduce:
Notice that every keystroke clears the input, so no number can be entered.
Debugging details:
Manually setting the value in the console (input.value = '12345') persists correctly, so the clearing only happens during typing.
Adding a listener trace showed that the module’s JS behavior forces field.value('') whenever iti.getNumber() returns an empty string, effectively erasing user input.
Expected behavior:
The field should allow users to type normally, and the number formatting/validation should only update the value if it is non-empty and valid.
Proposed solution:
Update the behavior so that the input value is only replaced when iti.getNumber() returns a valid number, instead of overwriting it with an empty string during typing.
Example:
field.addEventListener('keyup', () => {
var number = iti.getNumber();
if (number) {
field.val(number);
}
});
Needs review
4.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.