Skip to content
Snippets Groups Projects

feat(a11y): Set starting focus to progress bar in orientation

Merged Pierre Ecarlat requested to merge a11y/orientation/start-focus into dev
Files
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();
Loading