-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Description
When users type phone numbers using Arabic or Persian keyboards, intlTelInput blocks their input.
The reason is that the library validates key presses using /^[0-9]$/, which matches only ASCII digits (U+0030–0039).
Arabic and Persian digits are different Unicode code points.
Steps to reproduce:
1- Load intl-tel-input on any input. (strictMode: true)
2- Switch your keyboard to Arabic or Persian.
3- Try typing a number — input is rejected.
Expected behavior:
Arabic and Persian digits should be accepted and normalized to ASCII internally.
Suggested fix:
normalize the key before validations using:
const asciiDigit = key.replace(/[٠-٩]/g, c => String(c.charCodeAt(0) - 1632))
.replace(/[۰-۹]/g, c => String(c.charCodeAt(0) - 1776));or replace the:
^[0-9]$
with:
^[0-9\u0660-\u0669\u06F0-\u06F9]$
Metadata
Metadata
Assignees
Labels
No labels