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

オープン
#15,600 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@seragAhmed がすでに取り組んでいます。

2026年12月2日 から。

  • #15605 @seragAhmed による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
csharp

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
C#
スター
1.4k
フォーク
264
平均マージ
5時間 40分
マージ済み PR(30日)
489

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bitfoundation/bitplatform のほかの issue

bitfoundation/bitplatform の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。