Form: let Form.Item own label, extra and messages for every form control
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 10/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- react, typescript
調査の方向性
Start with how Form.Item clones props onto its child and where FormItemInputContext is published, then check one shadowed control such as TextInput and the exports.exclude.json mapping used for Dialog to Modal. Read Form.acceptance.test.tsx, which currently uses a plain <input>, to see what acceptance coverage must add. Done means a Form.Item with a failing rule shows one label linked by htmlFor, a red border with one message, and disabled state from <Form disabled>, across every shadowed control.
索引モデルが issue の本文から書いたものです。
説明
Problem
Every Astryx form control we re-export (TextInput, TextArea, NumberInput, Switch, CheckboxInput, CheckboxList, RadioList, Selector, MultiSelector, Typeahead, Date/Time inputs, Slider, FileInput, Tokenizer, the ComplexSelector fork) requires its own label and renders its own label, description and status message. Form.Item renders the same things. Inside a Form.Item the control and the item compete, so backend.ai-webui wraps each control in an adapter instead of using it directly:
react/src/components/astryxFormControls.tsx: 10 adapters, ~320 call sites. A second, drifted copy lives inpackages/backend.ai-ui/src/components/astryxFormControls.tsx.BAISelect,BAICheckbox,BAIUncontrolledInput,BAIDynamicUnitInputNumber,InputNumberWithSlider, plus about 10 one-off local adapters in feature files.- ~218 call sites pass the same string to
Form.Item labeland to the control'slabelwithisLabelHidden. Our own stories and README teach the same pattern (<Form.Item label="Name"><TextInput label="Name" isLabelHidden /></Form.Item>).
What the adapters work around, all of which belong in ui-common:
- Label.
label: stringis required and rendered, so callers duplicate it and hide one copy. - Status never reaches the control.
Form.ItempublishesFormItemInputContext, but no ui-common component reads it. A failed rule shows the message and leaves the border neutral. README:394 andForm.doc.mjs:105say controls read it, which nothing does. The webui host adapters read the context and pass{ type }with no message andstatusVariant="detached", so the result is a red border only. The BUI copy,BAISelectand the local adapters don't, so they have no red border. - Injected props are dropped.
Form.Itemclonesid,disabled,aria-describedby,aria-invalidandaria-requiredonto the child. Astryx 0.7.0:- Selector, MultiSelector, Switch, CheckboxInput and RadioList ignore
id, so the item's<label htmlFor>points at nothing. - Every control reads
isDisabled, notdisabled, so<Form disabled>does nothing. aria-invalidfollowsstatusonly.
- Selector, MultiSelector, Switch, CheckboxInput and RadioList ignore
- Value shape.
valueis required and non-nullable, so every call site writes?? '',?? falseor?? []. Value-firstonChangealready works withdefaultGetValueFromEvent. - Own components.
- StepNumberInput and ColorPicker have no
status. - StepNumberInput requires
label. - UncontrolledInput has no
value/onChangepair. - BulkEditFormItem passes a placeholder
labelplusisLabelHidden.
- StepNumberInput and ColorPicker have no
Proposal: match antd's contract
In antd, the item owns the label, extra, help and messages, and injects value/onChange/id. The control reads FormItemInputContext and paints only its border. Apply the same contract to every control that can sit in a Form.Item.
- Shadow the form controls with ui-common wrappers under the same names, through
exports.exclude.jsonlikeDialog→Modal. - Don't expose field-chrome props:
label,isLabelHidden,description,labelTooltip,labelIcon,isRequired/isOptional,statusVariant, andstatus.message. They go toForm.Item(label,tooltip,labelExtra,extra,help,required). Outside a form, the accessible name comes fromaria-labeloraria-labelledby. - Status:
- Read
FormItemInputContextwhen the control sits in aForm.Item. - Also accept an antd-style
statusprop:'error' | 'warning' | ''. - Map it to
{ type }with no message and a stablestatusVariant. MakingstatusVariantconditional remounts the input and loses focus, as webui learned. validatingandsuccessmap to no border.
- Read
- Honour injected
id,disabledandaria-*. Upstream theidfix where Astryx drops it. - Make
valueoptional:undefinedmeans empty. - Bring own form components in line: StepNumberInput, ColorPicker, PagedSelector, ComplexSelector fork and UncontrolledInput.
- Fix docs and stories: the README and
Form.doc.mjsexamples, and every story usingisLabelHiddeninsideForm.Item.
Decisions needed
-
Checkbox and Switch inline text. It is not the field label; antd uses
children. Decide whether to keep it aschildrenor as a renamed prop. -
Out of scope here, but they keep webui adapters alive:
- antd prop aliases:
allowClear,loading,size. - NumberInput clamp on blur.
- IME Enter guard.
tokenSeparators.- Selector popup placement.
Decide whether to add them to ui-common or leave them in the app.
- antd prop aliases:
-
Breaking change for 0.2 consumers: needs an
upgradecodemod. It should move the control'slabel/descriptionto the enclosingForm.Itemand dropisLabelHidden.
Done when
<Form.Item label="Name" name="name" rules={[{ required: true }]}><TextInput /></Form.Item>works with no adapter:- one label, linked by
htmlFor; - a red border and a single message on error;
- disabled by
<Form disabled>.
- one label, linked by
- The same holds for every shadowed control.
Form.acceptance.test.tsxcovers these with real Astryx controls; today it deliberately uses a plain<input>.- webui can delete
astryxFormControls.tsx(both copies) and the status bridging inBAISelectandBAICheckbox.
- 主要言語
- 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
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
lichess-org/lila#22324 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Feature Request] [Web] Expose kvCacheQuantizationBits in the onnxruntime-web WebGPU EP optionsオープンep:WebGPU platform:web quantization
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
microsoft/onnxruntime#33752 ·
メンテナーはふだん 2 日以内に返信
-
[Skill Bug]: entra-agent-id: inaccurate blueprint permission inheritance and parent token sub claimオープンbug entra-agent-id
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/GitHub-Copilot-for-Azure#3467 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
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 日以内に返信