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 <root@TI-03.OHB.LOCAL>
Co-authored-by: nwoodward <woodward.nicholas@gmail.com>
This commit is contained in:
Andrea-Guevara
2025-01-29 13:52:13 -03:00
committed by GitHub
parent 69164837f0
commit f262299382
5 changed files with 23 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
[tabIndex]="-1"
[routerLink]="[searchLink]"
[queryParams]="addQueryParams$ | async"
(click)="filterService.minimizeAll()">
(click)="announceFilter(); filterService.minimizeAll()">
<label class="mb-0 d-flex w-100">
<input type="checkbox" [checked]="false" class="my-1 align-self-stretch filter-checkbox"/>
<span class="w-100 pl-1 break-facet">

View File

@@ -12,7 +12,10 @@ import {
Router,
RouterLink,
} from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import {
TranslateModule,
TranslateService,
} from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@@ -20,6 +23,7 @@ import { PaginationService } from '../../../../../../core/pagination/pagination.
import { SearchService } from '../../../../../../core/shared/search/search.service';
import { SearchConfigurationService } from '../../../../../../core/shared/search/search-configuration.service';
import { SearchFilterService } from '../../../../../../core/shared/search/search-filter.service';
import { LiveRegionService } from '../../../../../../shared/live-region/live-region.service';
import { currentPath } from '../../../../../utils/route.utils';
import { ShortNumberPipe } from '../../../../../utils/short-number.pipe';
import { FacetValue } from '../../../../models/facet-value.model';
@@ -75,6 +79,8 @@ export class SearchFacetOptionComponent implements OnInit {
protected searchConfigService: SearchConfigurationService,
protected router: Router,
protected paginationService: PaginationService,
protected liveRegionService: LiveRegionService,
private translateService: TranslateService,
) {
}
@@ -119,4 +125,11 @@ export class SearchFacetOptionComponent implements OnInit {
return getFacetValueForType(this.filterValue, this.filterConfig);
}
/**
* Announces to the screen reader that the page will be reloaded, which filter has been selected
*/
announceFilter() {
const message = this.translateService.instant('search-facet-option.update.announcement', { filter: this.filterValue.value });
this.liveRegionService.addMessage(message);
}
}

View File

@@ -6769,4 +6769,6 @@
"register-page.registration.aria.label": "Enter your e-mail address",
"forgot-email.form.aria.label": "Enter your e-mail address",
"search-facet-option.update.announcement": "The page will be reloaded. Filter {{ filter }} is selected.",
}

View File

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

View File

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