BitPhoneInput leaves its Value empty when the number is typed in Persian or Arabic digits

Abierto
#15,600 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@seragAhmed ya está trabajando en esto.

Desde el 2/12/2026.

  • #15605 de @seragAhmed — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
csharp

Línea de trabajo

Read BitPhoneInput.razor.cs and locate KeepDigits, ComposeFullNumber and ParseFullNumber; then inspect the shared BitMask handling for its # slot. Compare digit handling with BitNumberField.NormalizeDigits. Done when Persian and Arabic decimal digits produce the expected phone value and work with Strict masking; the linked pull request is already open.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Describe the bug

BitPhoneInput ignores digits that are not ASCII. A number typed on a Persian or Arabic keyboard (۰۹۱۲۱۲۳۴۵۶۷, ٠٩١٢١٢٣٤٥٦٧), or pasted from a text written in those digits, is shown in the input, but Value stays null. A form whose submit button depends on the value (a sign-in page's "send code" button, for example) never enables, and the user cannot tell why.

With Strict, the same digits are discarded as they are typed, so the field stays empty.

Steps to reproduce

<BitPhoneInput @bind-Value="value" DefaultCountry="BitCountries.Iran" Immediate />
<p>Value: @value</p>

@code {
    private string? value;
}
  1. Type 09121234567: Value is +989121234567.
  2. Clear it and type ۰۹۱۲۱۲۳۴۵۶۷ (a Persian keyboard layout on Windows types these from the number row): Value stays empty.

Seen with Bit.BlazorUI.Extras 11.0.0-pre-10; the code below is the same on develop today (40f9925eb).

Cause

KeepDigits in BitPhoneInput.razor.cs keeps char.IsAsciiDigit characters alone, and the Value is composed from what it keeps (ComposeFullNumber, ParseFullNumber). The # slot of the shared BitMask takes char.IsAsciiDigit too, so a masked field drops them as well.

Expected behavior

Any decimal digit is read as the digit it is, as BitNumberField already does with NormalizeDigits. For example, in KeepDigits (and the same for a mask's # slot):

if (char.IsAsciiDigit(c))
{
    builder.Append(c);
}
else if (char.IsDigit(c))
{
    builder.Append((char)('0' + (int)char.GetNumericValue(c)));
}

Either always (a phone number is never meant to hold anything but its digits), or behind a NormalizeDigits parameter like BitNumberField's.

Workaround

A capture-phase input listener on window that rewrites [۰-۹٠-٩] into ASCII digits in every input[type=tel] before Blazor reads the value.

Lenguaje dominante
C#
Estrellas
1.4k
Forks
264
Merge medio
5 h 40 min
PR fusionados (30 d)
489

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bitfoundation/bitplatform

Todos los issues de bitfoundation/bitplatform

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.