NumberInput: Form.Item rules do not run while typing because onChange fires only on blur/Enter
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- react, typescript
調査の方向性
Start with the NumberInput re-export from @astryxdesign/core and Form.Item's validation trigger in src/components/Form/Field.tsx:469. Trace how draft input reaches Form.Item and compare it with TextInput's change behavior; the issue describes the relevant input and commit handlers in the upstream NumberInput source. Done means rules can validate the typed draft while standalone commit-on-blur behavior remains intact.
索引モデルが issue の本文から書いたものです。
説明
Problem
A Form.Item rule on a NumberInput does not run while the user types. The error appears only after the field loses focus or the user presses Enter.
<Form.Item name="size" rules={[{ type: "number", max: 100 }]}>
<NumberInput label="Size" />
</Form.Item>
Typing 150 shows no error until blur. TextInput and the other controls validate on every keystroke, so NumberInput fields behave differently from the rest of the form.
Cause
NumberInput is re-exported as is from @astryxdesign/core (0.7.0, src/astryx/NumberInput.ts). It keeps the text as a draft (pendingInput) while the user edits it, and calls onChange only at a commit boundary:
handleInputChangeonly callssetPendingInput(e.target.value).commitPendingInputcallsonChangeonblurorEnter, and only when the whole draft parses and is withinmin/max.
Form.Item validates on trigger="onChange" by default (src/components/Form/Field.tsx:469), so the field never sees a value during typing. The component exposes no per-keystroke callback (onFocus, onBlur, onEnter and onKeyDown only), so validateTrigger can't be pointed at another event either.
Because an invalid or out-of-range draft is never committed, a rule like max: 100 can't fire on that value at all. The input reverts or clamps on blur instead of showing the rule's message.
Expected
Inside a Form.Item, a NumberInput reports its value as the user types, so rules run on each keystroke like the other controls. Its standalone commit-on-blur behavior should stay as it is.
Possible directions
- Wrap or fork
NumberInputin ui-common so it emits the parsed draft (ornullwhen it does not parse) on each input change, and keep the commit/clamp on blur. - Ask Astryx upstream for a live callback (e.g.
onInputChange(value, text)) or acommitMode="change"option, then map it toForm.Item's trigger. - At minimum, document that
NumberInputrules run on blur, and usevalidateTrigger="onBlur"explicitly.
Related: #69 (Form.Item owning label/extra/messages for every control).
- 主要言語
- TypeScript
- スター
- 2
- フォーク
- 0
- 平均マージ
- 1日 16時間
- マージ済み PR(30日)
- 34
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
lablup/ui-common のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
メンテナーはふだん 1 日以内に返信
-
Stat: add a tooltip prop that explains the delta対応中かも @lablup-octodog が 1 日前に担当しました。 オープンfrontdesk
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
lablup/ui-common#112 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Stat: add a tooltip that explains the delta対応中かも @agatha197 が 1 日前に担当しました。 オープン
lablup/ui-common#110 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
lablup/ui-common の issue をすべて見る
似ている issue
-
fix(worker): keep normal prepare waiting states failure-free対応中かも @LichKing-2234 が今日担当しました。 オープンagent:codex priority:P1
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AgoraIO-Extensions/agent-infra#3745 ·
メンテナーはふだん 1 日以内に返信
-
The five-line work window can drop its oldest line: the per-line byte share ignores the JSON framing対応中かも @Eapp1e が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
makecindy/cindy#7973 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
lingdojo/kana-dojo#33337 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
code-yeongyu/senpi#4917 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信