@@ -96,7 +96,7 @@ export namespace HeaderProps {
9696 }
9797}
9898
99- export const headerMenuModalId = "header-menu-modal" ;
99+ export const headerMenuModalIdPrefix = "header-menu-modal" ;
100100
101101/** @see <https://components.react-dsfr.fr/?path=/docs/components-header> */
102102export const Header = memo (
@@ -124,14 +124,16 @@ export const Header = memo(
124124
125125 setBrandTopAndHomeLinkProps ( { brandTop, homeLinkProps } ) ;
126126
127- const { menuButtonId, searchModalId, searchInputId } = ( function useClosure ( ) {
127+ const { menuModalId , menuButtonId, searchModalId, searchInputId } = ( function useClosure ( ) {
128128 const id = useId ( ) ;
129129
130+ const menuModalId = `${ headerMenuModalIdPrefix } -${ id } ` ;
130131 const menuButtonId = `button-${ id } ` ;
131132 const searchModalId = `modal-${ id } ` ;
132133 const searchInputId = `search-${ id } -input` ;
133134
134135 return {
136+ menuModalId,
135137 menuButtonId,
136138 searchModalId,
137139 searchInputId
@@ -253,7 +255,7 @@ export const Header = memo(
253255 < button
254256 className = { fr . cx ( "fr-btn--menu" , "fr-btn" ) }
255257 data-fr-opened = "false"
256- aria-controls = { headerMenuModalId }
258+ aria-controls = { menuModalId }
257259 aria-haspopup = "menu"
258260 id = { menuButtonId }
259261 title = { t ( "menu" ) }
@@ -372,13 +374,13 @@ export const Header = memo(
372374 { ( navigation !== undefined || quickAccessItems . length !== 0 ) && (
373375 < div
374376 className = { cx ( fr . cx ( "fr-header__menu" , "fr-modal" ) , classes . menu ) }
375- id = { headerMenuModalId }
377+ id = { menuModalId }
376378 aria-labelledby = { menuButtonId }
377379 >
378380 < div className = { fr . cx ( "fr-container" ) } >
379381 < button
380382 className = { fr . cx ( "fr-btn--close" , "fr-btn" ) }
381- aria-controls = { headerMenuModalId }
383+ aria-controls = { menuModalId }
382384 title = { t ( "close" ) }
383385 >
384386 { t ( "close" ) }
0 commit comments