FormControl renders duplicate non-choice inputs when layout="horizontal"
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- react, typescript
調査の方向性
packages/react/src/FormControl/FormControl.tsx から始め、71–76 行目の input の検索と、138–159 行目の水平レンダリング分岐を確認します。提供されている水平および垂直の例を再現し、続いて水平の例に textbox が 1 つあることを検証するリグレッションテストを追加します。両方のレイアウトで input が 1 つレンダリングされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
FormControl's horizontal layout includes the same non-choice input twice in its render output.
The component finds the input in childrenWithoutSlots and renders a cloned version of it. However, the subsequent filter only excludes Checkbox and Radio, leaving non-choice inputs such as TextInput, Textarea, and Select in the remaining children. The original input is therefore rendered alongside the clone.
Expected behavior:
A FormControl containing one input should render exactly one input, regardless of whether its layout is horizontal or vertical.
Actual behavior indicated by the source:
With layout="horizontal" and a direct TextInput child, both the cloned TextInput and the original TextInput are included in the render output.
Relevant code in packages/react/src/FormControl/FormControl.tsx:
- Lines 71–76: find the input without removing it from childrenWithoutSlots.
- Lines 138–154: render the cloned input.
- Lines 155–159: render remaining children, excluding only Checkbox and Radio.
The vertical branch excludes all expectedInputComponents and does not have this duplication.
This report is based on source inspection of commit 8c0b708fc. Browser reproduction has not yet been performed.
Steps to reproduce
- Render the following example using the affected source checkout:
import {BaseStyles, FormControl, TextInput, ThemeProvider} from '@primer/react'
export default function App() {
return (
<ThemeProvider>
<BaseStyles>
<FormControl layout="horizontal">
<FormControl.Label>Name</FormControl.Label>
<TextInput />
</FormControl>
</BaseStyles>
</ThemeProvider>
)
}
- Inspect the rendered inputs inside FormControl.
- The horizontal branch is expected to produce two text inputs despite only one TextInput being supplied.
- Change layout to "vertical" and compare: the vertical branch should render only one text input.
A regression test can assert that getAllByRole('textbox') has a length of 1 for the horizontal example.
Version
38.40.0
Browser
No response
- 主要言語
- TypeScript
- スター
- 3.9k
- フォーク
- 697
- 平均マージ
- 3日 12時間
- マージ済み PR(30日)
- 41
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
primer/react のほかの issue
-
ActionMenu: add preventFocusOnClose対応中かも @tay1orjones が 6 日前に担当しました。 オープンcomponent: ActionMenu
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
primer/react#8488 · コメント 1 件 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
PageHeader.Title does not seem to accept id prop対応中かも @minwookshin が 12 日前に担当しました。 オープンcomponent: PageHeader react staff
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
primer/react#8474 · コメント 1 件 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
The padding prop seems to have no effect with PageLayout.Sidebar対応中かも @minwookshin が 12 日前に担当しました。 オープンcomponent: PageLayout react staff
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
primer/react#8470 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
bug component: Spinner react
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
primer/react#8423 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
waiting for author response
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
primer/react#8172 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
似ている issue
-
bug help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
agent-task risk:low
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
guyellis/http-status-check#512 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
microsoft/playwright#43327 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/TypeScript#64758 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
opensearch-project/OpenSearch-Dashboards#12937 ·
メンテナーはふだん 2 日以内に返信