diff --git a/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts b/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts index 65650971e82b46fc14d76a7fe2f3e37b430c16db..232206597084f24a768c1cb051f9c253d5758b4e 100644 --- a/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts +++ b/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; +import { Router } from '@angular/router'; import { ButtonComponent } from '../../../../shared/components'; import { NeedsType, OnlineDemarche } from '../../enums/orientation.enums'; import { MediationStepType, MediationType } from '../../types/orientation.types'; @@ -19,18 +19,16 @@ export class NavigationComponent { @Input() hideNavButtons = false; @Input() failedOrientation = false; - @Output() goNext = new EventEmitter<any>(); - @Output() goPrev = new EventEmitter<any>(); - @Output() goReset = new EventEmitter<any>(); + @Output() goNext = new EventEmitter<boolean>(); + @Output() goPrev = new EventEmitter<void>(); + @Output() goReset = new EventEmitter<void>(); @ViewChild('prevButton', { read: ButtonComponent }) prevButton: ButtonComponent; @ViewChild('nextButton', { read: ButtonComponent }) nextButton: ButtonComponent; public NeedsTypeEnum = NeedsType; - constructor( - private router: Router, - private route: ActivatedRoute, - ) {} + + constructor(private router: Router) {} public showPrevButton(): boolean { return this.currentStep !== null && !(this.isPrevHidden || this.isLastStep); @@ -38,20 +36,23 @@ export class NavigationComponent { public showNextButton(): boolean { return !this.hideNavButtons; } + public nextPage(isPrint?: boolean): void { this.goNext.emit(isPrint); } - public prevPage(): void { this.goPrev.emit(); } + public goCarto(): void { this.goReset.emit(); this.router.navigateByUrl('/acteurs'); } + public resetOrientation(): void { this.goReset.emit(); } + public focusFirstButton(): void { if (this.showPrevButton()) { this.prevButton.focus(); diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.html b/src/app/form/orientation-form-view/orientation-form-view.component.html index 43a2110fd0c0d3f0870d83c5d4f2aba8e8b42811..0f8dff1e189fc1b05d8eb76afbe3141fc0680751 100644 --- a/src/app/form/orientation-form-view/orientation-form-view.component.html +++ b/src/app/form/orientation-form-view/orientation-form-view.component.html @@ -1,4 +1,4 @@ -<div class="orientation"> +<div class="orientation" cdkTrapFocus [cdkTrapFocusAutoCapture]="true"> <h1 class="visually-hidden">Orientation</h1> <div class="visually-hidden"> <p>Utilisez <strong>f</strong> (footer) pour aller directement aux boutons de validation.</p> diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts index 8d091903b4bc19183050430cdc62ed972d179ae5..f100feab80206a17de4e73c43e0ee6e3eebace2d 100644 --- a/src/app/form/orientation-form-view/orientation-form-view.component.ts +++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts @@ -243,6 +243,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked private isOnlineDemarcheOrLearnSkills(): boolean { return this.needType === NeedsType.onlineDemarch || this.needType === NeedsType.learnSkills; } + /** * In online procedures (online mediation and appointment), a request is sent to the server before the orientation * summary. isPrevHidden flag prevents from going back in the form after validation. diff --git a/src/app/form/orientation-form-view/orientation-routing.module.ts b/src/app/form/orientation-form-view/orientation-routing.module.ts index 466c491d0bcc2918ac69250613d1d2829e7cfcde..de5dafc988b4bd55997a6807765d7ab4a39180ae 100644 --- a/src/app/form/orientation-form-view/orientation-routing.module.ts +++ b/src/app/form/orientation-form-view/orientation-routing.module.ts @@ -1,5 +1,5 @@ import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; +import { RouterModule, Routes } from '@angular/router'; import { DeactivateGuard } from '../../guards/deactivate.guard'; import { OrientationFormViewComponent } from './orientation-form-view.component'; diff --git a/src/app/form/orientation-form-view/orientation.module.ts b/src/app/form/orientation-form-view/orientation.module.ts index 978ffc8e3df2595cb0f8545d2b0ff3b3099aae69..3057ae8695865ddcdbfe3c81b932d1d6b768ea53 100644 --- a/src/app/form/orientation-form-view/orientation.module.ts +++ b/src/app/form/orientation-form-view/orientation.module.ts @@ -1,3 +1,4 @@ +import { A11yModule } from '@angular/cdk/a11y'; import { NgModule } from '@angular/core'; import { CartoModule } from '../../carto/carto.module'; import { SharedModule } from '../../shared/shared.module'; @@ -56,6 +57,6 @@ import { OrientationStructureListComponent } from './orientation-structure-list/ AppointmentEndComponent, InformationScreenComponent, ], - imports: [OrientationRoutingModule, CartoModule, SharedModule], + imports: [OrientationRoutingModule, CartoModule, SharedModule, A11yModule], }) export class OrientationModule {}