Skip to content

Commit a305641

Browse files
Riippiclaude
andcommitted
fix: stable ids for SelectionGroup date fields
HDS SelectionGroup unwraps a single wrapper child and renders the grandchildren in a list keyed by `child.props.id`. The two date-field Controllers had no id, producing undefined keys and a "unique key prop" warning under React 19's stricter dev validation (the @axe-core/react createElement wrapper surfaced it in the stack). Give each Controller a stable id so HDS has a real key. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e3e6bb0 commit a305641

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/components/exception-opening-hours-validity/ExceptionOpeningHoursValidity.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ const ExceptionOpeningHoursValidity = (): JSX.Element => {
3232
label={t('OpeningHours.ExceptionOpeningHoursValidity')}
3333
required>
3434
<div className="exception-opening-hours-validity__dates">
35+
{/* HDS SelectionGroup keys its children by props.id, so give
36+
each field a stable id to avoid a missing-key warning. */}
3537
<Controller
3638
defaultValue={startDate ?? ''}
3739
name="startDate"
40+
{...{ id: 'exception-start-date-field' }}
3841
render={({
3942
field: { name, onBlur, onChange, ref, value },
4043
fieldState,
@@ -75,6 +78,7 @@ const ExceptionOpeningHoursValidity = (): JSX.Element => {
7578
<Controller
7679
defaultValue={endDate ?? ''}
7780
name="endDate"
81+
{...{ id: 'exception-end-date-field' }}
7882
render={({
7983
field: { name, onBlur, onChange, ref, value },
8084
fieldState,

0 commit comments

Comments
 (0)