FormControl renders duplicate non-choice inputs when layout="horizontal"
Los mantenedores suelen responder en 2 días
@namangoyal176-10 ya está trabajando en esto.
Desde el 6/10/2026.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript
Línea de trabajo
Comienza en packages/react/src/FormControl/FormControl.tsx revisando la búsqueda de input en las líneas 71–76 y las ramas de renderizado horizontal en las líneas 138–159. Reproduce los ejemplos horizontal y vertical proporcionados y, a continuación, añade una prueba de regresión que compruebe que el ejemplo horizontal tiene un textbox; se considera completado cuando se renderiza un input en ambos layouts.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- TypeScript
- Estrellas
- 3.9k
- Forks
- 697
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 37
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de primer/react
-
ActionMenu: add preventFocusOnClosePosiblemente ocupada @tay1orjones la tomó hace 7 días. Abiertocomponent: ActionMenu
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
primer/react#8488 · 1 comentario · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
PageHeader.Title does not seem to accept id propPosiblemente ocupada @minwookshin la tomó hace 12 días. Abiertocomponent: PageHeader react staff
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
primer/react#8474 · 1 comentario · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
The padding prop seems to have no effect with PageLayout.SidebarPosiblemente ocupada @minwookshin la tomó hace 12 días. Abiertocomponent: PageLayout react staff
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
primer/react#8470 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 2 días
-
bug component: Spinner react
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
primer/react#8423 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Low contrast in SelectAbiertowaiting for author response
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
primer/react#8172 · 1 comentario ·
Los mantenedores suelen responder en 2 días
Todos los issues de primer/react
Issues similares
-
documentation good first issue hacktoberfest help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
libredb/libredb-studio#1756 ·
Los mantenedores suelen responder en 1 día
-
state:triage-needed
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
lingdojo/kana-dojo#32365 · 1 comentario · 5 reacciones ·
Los mantenedores suelen responder en 1 día
-
friction
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
kentcdodds/kody#3706 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
copperheadhq/copperhead#378 ·
Los mantenedores suelen responder en 1 día