Merge pull request #3918 from tdonohue/port_3385_to_8x

[Port dspace-8_x] Accessibility when selecting a search filter
This commit is contained in:
Tim Donohue
2025-01-29 12:07:09 -06:00
committed by GitHub
5 changed files with 23 additions and 4 deletions

View File

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

View File

@@ -12,7 +12,10 @@ import {
Router, Router,
RouterLink, RouterLink,
} from '@angular/router'; } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core'; import {
TranslateModule,
TranslateService,
} from '@ngx-translate/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
@@ -20,6 +23,7 @@ import { PaginationService } from '../../../../../../core/pagination/pagination.
import { SearchService } from '../../../../../../core/shared/search/search.service'; import { SearchService } from '../../../../../../core/shared/search/search.service';
import { SearchConfigurationService } from '../../../../../../core/shared/search/search-configuration.service'; import { SearchConfigurationService } from '../../../../../../core/shared/search/search-configuration.service';
import { SearchFilterService } from '../../../../../../core/shared/search/search-filter.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 { currentPath } from '../../../../../utils/route.utils';
import { ShortNumberPipe } from '../../../../../utils/short-number.pipe'; import { ShortNumberPipe } from '../../../../../utils/short-number.pipe';
import { FacetValue } from '../../../../models/facet-value.model'; import { FacetValue } from '../../../../models/facet-value.model';
@@ -75,6 +79,8 @@ export class SearchFacetOptionComponent implements OnInit {
protected searchConfigService: SearchConfigurationService, protected searchConfigService: SearchConfigurationService,
protected router: Router, protected router: Router,
protected paginationService: PaginationService, protected paginationService: PaginationService,
protected liveRegionService: LiveRegionService,
private translateService: TranslateService,
) { ) {
} }
@@ -119,4 +125,11 @@ export class SearchFacetOptionComponent implements OnInit {
return getFacetValueForType(this.filterValue, this.filterConfig); 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

@@ -6775,4 +6775,6 @@
"register-page.registration.aria.label": "Enter your e-mail address", "register-page.registration.aria.label": "Enter your e-mail address",
"forgot-email.form.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

@@ -10201,5 +10201,6 @@
// "forgot-email.form.aria.label": "Enter your e-mail address", // "forgot-email.form.aria.label": "Enter your e-mail address",
"forgot-email.form.aria.label": "Introduzca su dirección de correo electrónico", "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

@@ -10258,4 +10258,7 @@
// "forgot-email.form.aria.label": "Enter your e-mail address", // "forgot-email.form.aria.label": "Enter your e-mail address",
"forgot-email.form.aria.label": "Digite seu e-mail", "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.",
} }