Skip to content

Commit b27659d

Browse files
Andrea-Guevararootnwoodward
authored andcommitted
Accessibility when selecting a search filter (#3385)
* Creation of a new method so that when a filter is selected a page reload message is announced to the user * Correcting import formatting errors * New attempt - Correcting import formatting errors * New import fix * New import fix * Returning to the order of imports more like the original * Correcting import order errors * Resolving conflicts * lint fixes * Code refactoring --------- Co-authored-by: root <[email protected]> Co-authored-by: nwoodward <[email protected]>
1 parent df3e00f commit b27659d

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[tabIndex]="-1"
33
[routerLink]="[searchLink]"
44
[queryParams]="addQueryParams$ | async"
5-
(click)="filterService.minimizeAll()">
5+
(click)="announceFilter(); filterService.minimizeAll()">
66
<label class="mb-0 d-flex w-100">
77
<input type="checkbox" [checked]="false" class="my-1 align-self-stretch filter-checkbox"/>
88
<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: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@ import {
1212
Router,
1313
RouterLink,
1414
} from '@angular/router';
15-
import { TranslateModule } from '@ngx-translate/core';
15+
import {
16+
TranslateModule,
17+
TranslateService,
18+
} from '@ngx-translate/core';
1619
import { Observable } from 'rxjs';
1720
import { map } from 'rxjs/operators';
1821

1922
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
2023
import { SearchService } from '../../../../../../core/shared/search/search.service';
2124
import { SearchConfigurationService } from '../../../../../../core/shared/search/search-configuration.service';
2225
import { SearchFilterService } from '../../../../../../core/shared/search/search-filter.service';
26+
import { LiveRegionService } from '../../../../../../shared/live-region/live-region.service';
2327
import { currentPath } from '../../../../../utils/route.utils';
2428
import { ShortNumberPipe } from '../../../../../utils/short-number.pipe';
2529
import { FacetValue } from '../../../../models/facet-value.model';
@@ -75,6 +79,8 @@ export class SearchFacetOptionComponent implements OnInit {
7579
protected searchConfigService: SearchConfigurationService,
7680
protected router: Router,
7781
protected paginationService: PaginationService,
82+
protected liveRegionService: LiveRegionService,
83+
private translateService: TranslateService,
7884
) {
7985
}
8086

@@ -119,4 +125,11 @@ export class SearchFacetOptionComponent implements OnInit {
119125
return getFacetValueForType(this.filterValue, this.filterConfig);
120126
}
121127

128+
/**
129+
* Announces to the screen reader that the page will be reloaded, which filter has been selected
130+
*/
131+
announceFilter() {
132+
const message = this.translateService.instant('search-facet-option.update.announcement', { filter: this.filterValue.value });
133+
this.liveRegionService.addMessage(message);
134+
}
122135
}

src/assets/i18n/en.json5

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

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

src/assets/i18n/es.json5

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10201,5 +10201,6 @@
1020110201
// "forgot-email.form.aria.label": "Enter your e-mail address",
1020210202
"forgot-email.form.aria.label": "Introduzca su dirección de correo electrónico",
1020310203

10204-
10205-
}
10204+
// "search-facet-option.update.announcement": "The page will be reloaded. Filter {{ filter }} is selected.",
10205+
"search-facet-option.update.announcement": "La página será recargada. Filtro {{ filter }} seleccionado.",
10206+
}

src/assets/i18n/pt-BR.json5

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

1025910259
// "forgot-email.form.aria.label": "Enter your e-mail address",
1026010260
"forgot-email.form.aria.label": "Digite seu e-mail",
10261+
10262+
// "search-facet-option.update.announcement": "The page will be reloaded. Filter {{ filter }} is selected.",
10263+
"search-facet-option.update.announcement": "A página será recarregada. O filtro {{ filter }} foi selecionado.",
1026110264
}

0 commit comments

Comments
 (0)