-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19c5ff1
commit 1febc14
Showing
11 changed files
with
81 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use client' | ||
|
||
import { usePathname } from 'next/navigation' | ||
import React, { useEffect, useRef, useState } from 'react' | ||
|
||
export default function A11yPageTitle() { | ||
const pathname = usePathname() | ||
const refContainer = useRef<HTMLDivElement>(null) | ||
|
||
const [pageTitle, setPageTitle] = useState<string>() | ||
|
||
useEffect(() => { | ||
setPageTitle(document.title) | ||
refContainer.current?.focus() | ||
}, [pathname]) | ||
|
||
return ( | ||
<div ref={refContainer} tabIndex={-1} className='sr-only'> | ||
{pageTitle} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,51 @@ | ||
'use client' | ||
|
||
import { usePathname } from 'next/navigation' | ||
import React, { useEffect, useRef, useState } from 'react' | ||
import React, { useEffect, useState } from 'react' | ||
|
||
import { ID_CHAT, ID_CONTENU, ID_MENU } from 'components/globals' | ||
import { useMobileViewport } from 'utils/mobileViewportContext' | ||
|
||
export default function LiensEvitement() { | ||
const pathname = usePathname() | ||
const refContainer = useRef<HTMLDivElement>(null) | ||
|
||
const isMobileViewport = useMobileViewport() | ||
|
||
const [pageTitle, setPageTitle] = useState<string>() | ||
const [pageHasChatAside, setPageHasChatAside] = useState<boolean>(false) | ||
|
||
useEffect(() => { | ||
setPageTitle(document.title) | ||
}, [pathname]) | ||
|
||
useEffect(() => { | ||
if (refContainer.current) { | ||
refContainer.current.focus() | ||
} | ||
}, [pageTitle]) | ||
|
||
useEffect(() => { | ||
setPageHasChatAside(Boolean(document.getElementById(ID_CHAT))) | ||
}, [pageTitle]) | ||
}, [pathname]) | ||
|
||
if (isMobileViewport) return null | ||
|
||
return ( | ||
<> | ||
<div ref={refContainer} tabIndex={-1} className='sr-only'> | ||
{pageTitle} | ||
</div> | ||
<ul className='sr-only focus-within:not-sr-only'> | ||
<li> | ||
<a | ||
href={`#${ID_CONTENU}`} | ||
className='text-primary_darken hover:text-primary' | ||
> | ||
Aller au contenu | ||
</a> | ||
</li> | ||
<ul className='sr-only focus-within:not-sr-only'> | ||
<li> | ||
<a | ||
href={`#${ID_CONTENU}`} | ||
className='text-primary_darken hover:text-primary' | ||
> | ||
Aller au contenu | ||
</a> | ||
</li> | ||
<li> | ||
<a | ||
href={`#${ID_MENU}`} | ||
className='text-primary_darken hover:text-primary' | ||
> | ||
Aller au menu | ||
</a> | ||
</li> | ||
{pageHasChatAside && ( | ||
<li> | ||
<a | ||
href={`#${ID_MENU}`} | ||
href={`#${ID_CHAT}`} | ||
className='text-primary_darken hover:text-primary' | ||
> | ||
Aller au menu | ||
Aller aux conversations | ||
</a> | ||
</li> | ||
{pageHasChatAside && ( | ||
<li> | ||
<a | ||
href={`#${ID_CHAT}`} | ||
className='text-primary_darken hover:text-primary' | ||
> | ||
Aller aux conversations | ||
</a> | ||
</li> | ||
)} | ||
</ul> | ||
</> | ||
)} | ||
</ul> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters