11import React , { memo , forwardRef , useId , type ReactNode , type CSSProperties } from "react" ;
2- import { fr } from "./fr" ;
3- import { createComponentI18nApi } from "./i18n" ;
2+ import { fr } from ".. /fr" ;
3+ import { createComponentI18nApi } from ".. /i18n" ;
44import { symToStr } from "tsafe/symToStr" ;
5- import { cx } from "./tools/cx" ;
6- import { getLink } from "./link" ;
7- import type { RegisteredLinkProps } from "./link" ;
5+ import { cx } from ".. /tools/cx" ;
6+ import { getLink } from ".. /link" ;
7+ import type { RegisteredLinkProps } from ".. /link" ;
88import { assert } from "tsafe/assert" ;
99import type { Equals } from "tsafe" ;
10- import type { FrIconClassName , RiIconClassName } from "./fr/generatedFromCss/classNames" ;
11- import type { MainNavigationProps } from "./MainNavigation" ;
12- import { MainNavigation } from "./MainNavigation" ;
13- import { Display } from "./Display/Display" ;
14- import { setBrandTopAndHomeLinkProps } from "./zz_internal/brandTopAndHomeLinkProps" ;
10+ import type { FrIconClassName , RiIconClassName } from ".. /fr/generatedFromCss/classNames" ;
11+ import type { MainNavigationProps } from ".. /MainNavigation" ;
12+ import { MainNavigation } from ".. /MainNavigation" ;
13+ import { Display } from ".. /Display/Display" ;
14+ import { setBrandTopAndHomeLinkProps } from ".. /zz_internal/brandTopAndHomeLinkProps" ;
1515import { typeGuard } from "tsafe/typeGuard" ;
16- import { SearchButton } from "./SearchBar/SearchButton" ;
17- import { useTranslation as useSearchBarTranslation } from "./SearchBar/SearchBar" ;
16+ import { SearchButton } from ".. /SearchBar/SearchButton" ;
17+ import { useTranslation as useSearchBarTranslation } from ".. /SearchBar/SearchBar" ;
1818
1919export type HeaderProps = {
2020 className ?: string ;
@@ -96,6 +96,8 @@ export namespace HeaderProps {
9696 }
9797}
9898
99+ export const headerMenuModalId = "header-menu-modal" ;
100+
99101/** @see <https://components.react-dsfr.fr/?path=/docs/components-header> */
100102export const Header = memo (
101103 forwardRef < HTMLDivElement , HeaderProps > ( ( props , ref ) => {
@@ -122,17 +124,15 @@ export const Header = memo(
122124
123125 setBrandTopAndHomeLinkProps ( { brandTop, homeLinkProps } ) ;
124126
125- const { menuButtonId, menuModalId , searchModalId, searchInputId } = ( function useClosure ( ) {
127+ const { menuButtonId, searchModalId, searchInputId } = ( function useClosure ( ) {
126128 const id = useId ( ) ;
127129
128130 const menuButtonId = `button-${ id } ` ;
129- const menuModalId = `modal-${ id } ` ;
130131 const searchModalId = `modal-${ id } ` ;
131132 const searchInputId = `search-${ id } -input` ;
132133
133134 return {
134135 menuButtonId,
135- menuModalId,
136136 searchModalId,
137137 searchInputId
138138 } ;
@@ -253,7 +253,7 @@ export const Header = memo(
253253 < button
254254 className = { fr . cx ( "fr-btn--menu" , "fr-btn" ) }
255255 data-fr-opened = "false"
256- aria-controls = { menuModalId }
256+ aria-controls = { headerMenuModalId }
257257 aria-haspopup = "menu"
258258 id = { menuButtonId }
259259 title = { t ( "menu" ) }
@@ -372,13 +372,13 @@ export const Header = memo(
372372 { ( navigation !== undefined || quickAccessItems . length !== 0 ) && (
373373 < div
374374 className = { cx ( fr . cx ( "fr-header__menu" , "fr-modal" ) , classes . menu ) }
375- id = { menuModalId }
375+ id = { headerMenuModalId }
376376 aria-labelledby = { menuButtonId }
377377 >
378378 < div className = { fr . cx ( "fr-container" ) } >
379379 < button
380380 className = { fr . cx ( "fr-btn--close" , "fr-btn" ) }
381- aria-controls = { menuModalId }
381+ aria-controls = { headerMenuModalId }
382382 title = { t ( "close" ) }
383383 >
384384 { t ( "close" ) }
0 commit comments