Skip to content

Commit 073b2b0

Browse files
rootroot
authored andcommitted
Accessibility when selecting a search filter v7
1 parent 795f300 commit 073b2b0

5 files changed

Lines changed: 23 additions & 2 deletions

File tree

src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<a *ngIf="isVisible | async" class="d-flex flex-row"
22
[tabIndex]="-1"
33
[routerLink]="[searchLink]"
4-
[queryParams]="addQueryParams" queryParamsHandling="merge">
4+
[queryParams]="addQueryParams" queryParamsHandling="merge"
5+
(click)="announceFilter()">
56
<label class="mb-0 d-flex w-100">
67
<input type="checkbox" [checked]="false" class="my-1 align-self-stretch filter-checkbox"/>
78
<span class="w-100 pl-1 break-facet">

src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import { combineLatest as observableCombineLatest, Observable, Subscription } fr
22
import { map } from 'rxjs/operators';
33
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
44
import { Router } from '@angular/router';
5+
import { TranslateService } from '@ngx-translate/core';
56
import { FacetValue } from '../../../../models/facet-value.model';
67
import { SearchFilterConfig } from '../../../../models/search-filter-config.model';
78
import { SearchService } from '../../../../../../core/shared/search/search.service';
89
import { SearchFilterService } from '../../../../../../core/shared/search/search-filter.service';
10+
import { LiveRegionService } from '../../../../../../shared/live-region/live-region.service';
911
import { SearchConfigurationService } from '../../../../../../core/shared/search/search-configuration.service';
1012
import { hasValue } from '../../../../../empty.util';
1113
import { currentPath } from '../../../../../utils/route.utils';
@@ -67,7 +69,9 @@ export class SearchFacetOptionComponent implements OnInit, OnDestroy {
6769
protected filterService: SearchFilterService,
6870
protected searchConfigService: SearchConfigurationService,
6971
protected router: Router,
70-
protected paginationService: PaginationService
72+
protected paginationService: PaginationService,
73+
protected liveRegionService: LiveRegionService,
74+
private translateService: TranslateService,
7175
) {
7276
}
7377

@@ -129,4 +133,12 @@ export class SearchFacetOptionComponent implements OnInit, OnDestroy {
129133
this.sub.unsubscribe();
130134
}
131135
}
136+
137+
/**
138+
* Announces to the screen reader that the page will be reloaded, which filter has been selected
139+
*/
140+
announceFilter() {
141+
const message = this.translateService.instant('search-facet-option.update.announcement', { filter: this.filterValue.value });
142+
this.liveRegionService.addMessage(message);
143+
}
132144
}

src/assets/i18n/en.json5

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5397,4 +5397,6 @@
53975397
"register-page.registration.aria.label": "Enter your e-mail address",
53985398

53995399
"forgot-email.form.aria.label": "Enter your e-mail address",
5400+
5401+
"search-facet-option.update.announcement": "The page will be reloaded. Filter {{ filter }} is selected.",
54005402
}

src/assets/i18n/es.json5

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7839,4 +7839,7 @@
78397839

78407840
// "forgot-email.form.aria.label": "Enter your e-mail address",
78417841
"forgot-email.form.aria.label": "Introduzca su dirección de correo electrónico",
7842+
7843+
// "search-facet-option.update.announcement": "The page will be reloaded. Filter {{ filter }} is selected.",
7844+
"search-facet-option.update.announcement": "La página será recargada. Filtro {{ filter }} seleccionado.",
78427845
}

src/assets/i18n/pt-BR.json5

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7866,4 +7866,7 @@
78667866

78677867
// "forgot-email.form.aria.label": "Enter your e-mail address",
78687868
"forgot-email.form.aria.label": "Digite seu e-mail",
7869+
7870+
// "search-facet-option.update.announcement": "The page will be reloaded. Filter {{ filter }} is selected.",
7871+
"search-facet-option.update.announcement": "A página será recarregada. O filtro {{ filter }} foi selecionado.",
78697872
}

0 commit comments

Comments
 (0)