Skip to content

Commit 2a17397

Browse files
committed
feat(admin-usagers): add skip links to admin and usagers
1 parent aa46dc8 commit 2a17397

File tree

8 files changed

+39
-97
lines changed

8 files changed

+39
-97
lines changed

packages/portail-admins/src/app/app.component.html

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,5 @@
11
<app-custom-toastr></app-custom-toastr>
2-
<nav id="skip-links" role="navigation" aria-label="Accès rapide">
3-
<ul>
4-
<li>
5-
<a
6-
ariaCurrentWhenActive="page"
7-
routerLinkActive="router-link-active"
8-
[routerLink]="currentUrl"
9-
fragment="navigation"
10-
>Aller à la navigation</a
11-
>
12-
</li>
13-
<li>
14-
<a
15-
ariaCurrentWhenActive="page"
16-
routerLinkActive="router-link-active"
17-
[routerLink]="currentUrl"
18-
fragment="page"
19-
>Aller au contenu</a
20-
>
21-
</li>
22-
<li *ngIf="currentUrl === '/manage'">
23-
<a
24-
ariaCurrentWhenActive="page"
25-
routerLinkActive="router-link-active"
26-
[routerLink]="currentUrl"
27-
fragment="search-bar"
28-
>Aller à la recherche</a
29-
>
30-
</li>
31-
<li>
32-
<a
33-
ariaCurrentWhenActive="page"
34-
routerLinkActive="router-link-active"
35-
[routerLink]="currentUrl"
36-
fragment="footer"
37-
>Aller au pied de page</a
38-
>
39-
</li>
40-
</ul>
41-
</nav>
42-
2+
<dsfr-skiplinks [links]="skipLinks"></dsfr-skiplinks>
433
<header id="page-header" role="banner">
444
<nav
455
class="navbar bg-white"

packages/portail-admins/src/app/app.component.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { LIENS_PARTENAIRES } from "./modules/general/components/static-pages/pla
88
import { PortailAdminUser } from "@domifa/common";
99
import { faChartBar } from "@fortawesome/free-regular-svg-icons";
1010
import { faList, faUsers } from "@fortawesome/free-solid-svg-icons";
11+
import { DsfrLink } from "@edugouvfr/ngx-dsfr";
1112

1213
@Component({
1314
selector: "app-root",
@@ -21,7 +22,7 @@ export class AppComponent implements OnInit {
2122
public faUsers = faUsers;
2223
public faList = faList;
2324
public currentUrl = "";
24-
25+
public skipLinks: DsfrLink[] = [];
2526
constructor(
2627
private readonly router: Router,
2728
private readonly titleService: Title,
@@ -32,7 +33,6 @@ export class AppComponent implements OnInit {
3233

3334
public ngOnInit(): void {
3435
this.currentUrl = this.router.url;
35-
3636
this.titleService.setTitle("Bienvenue sur le portail admin de DomiFa");
3737

3838
this.adminAuthService.currentAdminSubject.subscribe(
@@ -47,6 +47,21 @@ export class AppComponent implements OnInit {
4747
const event = ev as unknown as NavigationEnd;
4848
const splitUrl = event?.url.split("#");
4949
this.currentUrl = splitUrl[0];
50+
this.skipLinks = [
51+
{
52+
label: "Aller à la navigation",
53+
link: `${this.currentUrl}#navigation`,
54+
},
55+
{ label: "Aller au contenu", link: `${this.currentUrl}#page` },
56+
{
57+
label: "Aller à la recherche",
58+
link: `${this.currentUrl}#search-bar`,
59+
},
60+
{
61+
label: "Aller au pied de page",
62+
link: `${this.currentUrl}#footer`,
63+
},
64+
];
5065

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

packages/portail-admins/src/app/modules/shared/shared.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
import { FonctionSelectionComponent } from "./components/fonction-selection/fonction-selection.component";
1818
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
1919
import { FonctionFormatPipe } from "./pipes/fonction-format.pipe";
20-
import { DsfrAlertModule } from "@edugouvfr/ngx-dsfr";
20+
import { DsfrAlertModule, DsfrSkiplinksModule } from "@edugouvfr/ngx-dsfr";
2121

2222
@NgModule({
2323
declarations: [
@@ -37,6 +37,7 @@ import { DsfrAlertModule } from "@edugouvfr/ngx-dsfr";
3737
CustomToastrComponent,
3838
FonctionSelectionComponent,
3939
FonctionFormatPipe,
40+
DsfrSkiplinksModule,
4041
],
4142
imports: [
4243
CommonModule,
@@ -45,6 +46,7 @@ import { DsfrAlertModule } from "@edugouvfr/ngx-dsfr";
4546
ReactiveFormsModule,
4647
FonctionFormatPipe,
4748
DsfrAlertModule,
49+
DsfrSkiplinksModule,
4850
],
4951
providers: [AdminStructuresApiClient],
5052
})

packages/portail-usagers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@
8686
"ng-lint-staged lint --fix --"
8787
]
8888
}
89-
}
89+
}

packages/portail-usagers/src/app/app.component.html

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,6 @@
11
<app-custom-toastr></app-custom-toastr>
22
<app-idle-manager></app-idle-manager>
3-
<nav class="fr-container" aria-label="Accès rapide">
4-
<ul id="skip-links">
5-
<li>
6-
<a
7-
ariaCurrentWhenActive="page"
8-
routerLinkActive="router-link-active"
9-
[routerLink]="currentUrl"
10-
fragment="page"
11-
>Aller au contenu</a
12-
>
13-
</li>
14-
<li>
15-
<a
16-
ariaCurrentWhenActive="page"
17-
routerLinkActive="router-link-active"
18-
[routerLink]="currentUrl"
19-
fragment="footer"
20-
>Aller au pied de page</a
21-
>
22-
</li>
23-
</ul>
24-
</nav>
3+
<dsfr-skiplinks [links]="skipLinks"></dsfr-skiplinks>
254
<header id="page-header" role="banner">
265
<div id="matomo-info" *ngIf="!matomoInfo">
276
<div

packages/portail-usagers/src/app/app.component.scss

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,6 @@ footer {
3030
}
3131
}
3232

33-
#skip-links {
34-
width: 100%;
35-
padding: 0.25rem 0;
36-
background-color: white;
37-
position: absolute;
38-
top: 0;
39-
transform: translateY(-100%);
40-
41-
li {
42-
display: inline-block;
43-
list-style-type: none;
44-
}
45-
46-
a {
47-
display: block;
48-
padding: 1rem 2rem;
49-
}
50-
}
51-
52-
#skip-links:focus-within {
53-
position: relative;
54-
transform: translateY(0%);
55-
}
56-
5733
#matomo-info a {
5834
color: #292929;
5935
text-decoration: underline;

packages/portail-usagers/src/app/app.component.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { MatomoTracker } from "ngx-matomo-client";
99
import DOMIFA_NEWS from "../assets/files/news.json";
1010
import { NgbModal, NgbModalRef } from "@ng-bootstrap/ng-bootstrap";
1111
import { faRightFromBracket } from "@fortawesome/free-solid-svg-icons";
12+
import { DsfrLink } from "@edugouvfr/ngx-dsfr";
1213

1314
@Component({
1415
selector: "app-root",
@@ -23,6 +24,7 @@ export class AppComponent implements OnInit {
2324
public readonly partnerLinks = LIENS_PARTENAIRES;
2425
public readonly faRightFromBracket = faRightFromBracket;
2526
public pendingNews = false;
27+
public skipLinks: DsfrLink[] = [];
2628
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2729
public news: any;
2830

@@ -34,7 +36,7 @@ export class AppComponent implements OnInit {
3436
private readonly router: Router,
3537
private readonly usagerAuthService: UsagerAuthService,
3638
private readonly matomo: MatomoTracker,
37-
private readonly modalService: NgbModal,
39+
private readonly modalService: NgbModal
3840
) {
3941
this.apiVersion = null;
4042
this.usagerProfile = null;
@@ -92,14 +94,18 @@ export class AppComponent implements OnInit {
9294
this.modalService.dismissAll();
9395
localStorage.setItem(
9496
"NEWS_MON_DOMIFA",
95-
new Date(DOMIFA_NEWS[0].date).toISOString(),
97+
new Date(DOMIFA_NEWS[0].date).toISOString()
9698
);
9799
this.pendingNews = false;
98100
}
99101

102+
public onSkiplinkSelect(event: string): void {
103+
console.log("skiplink select", event);
104+
}
105+
100106
public ngOnInit(): void {
101107
this.titleService.setTitle(
102-
"Mon DomiFa, l'outil qui facilite la gestion des structures domiciliatirices",
108+
"Mon DomiFa, l'outil qui facilite la gestion des structures domiciliatirices"
103109
);
104110

105111
this.usagerAuthService.currentUsagerSubject.subscribe(
@@ -109,7 +115,7 @@ export class AppComponent implements OnInit {
109115
if (usager) {
110116
this.checkNews();
111117
}
112-
},
118+
}
113119
);
114120

115121
this.router.events
@@ -119,7 +125,10 @@ export class AppComponent implements OnInit {
119125
const event = ev as unknown as NavigationEnd;
120126
const splitUrl = event?.url.split("#");
121127
this.currentUrl = splitUrl[0];
122-
128+
this.skipLinks = [
129+
{ label: "Aller au contenu", link: `${this.currentUrl}#page` },
130+
{ label: "Aller au pied de page", link: `${this.currentUrl}#footer` },
131+
];
123132
if (typeof splitUrl[1] !== "undefined") {
124133
const fragment = splitUrl[1];
125134
const element = document.getElementById(fragment);

packages/portail-usagers/src/app/modules/shared/shared.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import { FA_ICONS } from "./constants/FA_ICONS.const";
99
import { CustomToastrComponent } from "./components/custom-toastr/custom-toastr.component";
1010
import { SeoService } from "./services/seo.service";
1111
import { ReplaceLineBreaks } from "./pipes/nl2br.pipe";
12+
import { DsfrSkiplinksModule } from "@edugouvfr/ngx-dsfr";
1213

1314
@NgModule({
1415
declarations: [CustomToastrComponent, ReplaceLineBreaks],
15-
exports: [CustomToastrComponent, ReplaceLineBreaks],
16+
exports: [CustomToastrComponent, ReplaceLineBreaks, DsfrSkiplinksModule],
1617
providers: [SeoService],
1718
imports: [CommonModule, FontAwesomeModule],
1819
})

0 commit comments

Comments
 (0)