Skip to content

Commit 757cc63

Browse files
committed
feat(frontend): lien d'evitement
1 parent 2da0975 commit 757cc63

File tree

3 files changed

+24
-35
lines changed

3 files changed

+24
-35
lines changed

packages/frontend/src/app/app.component.html

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,7 @@
11
<app-custom-toastr></app-custom-toastr>
22
<app-loading></app-loading>
33
<app-idle-manager></app-idle-manager>
4-
<nav id="skip-links" role="navigation" aria-label="Accès rapide">
5-
<ul>
6-
<li>
7-
<a
8-
ariaCurrentWhenActive="page"
9-
[routerLink]="currentUrl"
10-
fragment="navigation"
11-
>Aller à la navigation</a
12-
>
13-
</li>
14-
<li>
15-
<a ariaCurrentWhenActive="page" [routerLink]="currentUrl" fragment="page"
16-
>Aller au contenu</a
17-
>
18-
</li>
19-
<li *ngIf="currentUrl === '/manage'">
20-
<a
21-
ariaCurrentWhenActive="page"
22-
[routerLink]="currentUrl"
23-
fragment="search-bar"
24-
>Aller à la recherche</a
25-
>
26-
</li>
27-
<li>
28-
<a
29-
ariaCurrentWhenActive="page"
30-
[routerLink]="currentUrl"
31-
fragment="footer"
32-
>Aller au pied de page</a
33-
>
34-
</li>
35-
</ul>
36-
</nav>
4+
<dsfr-skiplinks [links]="skipLinks"></dsfr-skiplinks>
375
<app-help-modal></app-help-modal>
386

397
<app-navbar [pendingNews]="pendingNews" [me]="me"></app-navbar>

packages/frontend/src/app/app.component.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { fadeInOut } from "./shared";
2525
import DOMIFA_NEWS from "../assets/files/news.json";
2626
import { LIENS_PARTENAIRES } from "./modules/general/components/plan-site/LIENS_PARTENAIRES.const";
2727
import { UserStructure } from "@domifa/common";
28+
import { DsfrLink } from "@edugouvfr/ngx-dsfr";
2829

2930
@Component({
3031
animations: [fadeInOut],
@@ -48,7 +49,7 @@ export class AppComponent implements OnInit, OnDestroy {
4849
public loading: boolean;
4950
public submitted: boolean;
5051
public pendingNews: boolean;
51-
52+
public skipLinks: DsfrLink[] = [];
5253
private readonly subscription = new Subscription();
5354

5455
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -158,6 +159,25 @@ export class AppComponent implements OnInit, OnDestroy {
158159
const event = ev as NavigationEnd;
159160
const splitUrl = event?.url.split("#");
160161
this.currentUrl = splitUrl[0];
162+
this.skipLinks = [
163+
{
164+
label: "Aller à la navigation",
165+
link: `${this.currentUrl}#navigation`,
166+
},
167+
...(this.currentUrl === "/manage" // pour avoir le bon ordre des liens
168+
? [
169+
{
170+
label: "Aller à la recherche",
171+
link: `${this.currentUrl}#search-bar`,
172+
},
173+
]
174+
: []),
175+
{ label: "Aller au contenu", link: `${this.currentUrl}#page` },
176+
{
177+
label: "Aller au pied de page",
178+
link: `${this.currentUrl}#footer`,
179+
},
180+
];
161181

162182
if (typeof splitUrl[1] !== "undefined") {
163183
const fragment = splitUrl[1];

packages/frontend/src/app/modules/shared/shared.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { InputReferrerComponent } from "./components/input-referrer/input-referr
1515
import { FormsModule } from "@angular/forms";
1616
import { FonctionSelectionComponent } from "./components/fonction-selection/fonction-selection.component";
1717
import { FonctionFormatPipe } from "./pipes/fonction-format.pipe";
18-
18+
import { DsfrSkiplinksModule } from "@edugouvfr/ngx-dsfr";
1919
@NgModule({
2020
imports: [
2121
CommonModule,
@@ -43,6 +43,7 @@ import { FonctionFormatPipe } from "./pipes/fonction-format.pipe";
4343
FontAwesomeModule,
4444
ButtonComponent,
4545
FonctionFormatPipe,
46+
DsfrSkiplinksModule,
4647
],
4748
schemas: [CUSTOM_ELEMENTS_SCHEMA],
4849
})

0 commit comments

Comments
 (0)