Skip to content

Commit 51aa5fb

Browse files
authored
Merge pull request DSpace#3926 from Andrea-Guevara/AccessibilityInSearchFilterDspace7
[Port dspace-7_x] Accessibility when selecting a search filter
2 parents 0abbf80 + a5378e0 commit 51aa5fb

6 files changed

Lines changed: 26 additions & 3 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.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { PaginationComponentOptions } from '../../../../../pagination/pagination
1919
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
2020
import { PaginationServiceStub } from '../../../../../testing/pagination-service.stub';
2121
import { ShortNumberPipe } from '../../../../../utils/short-number.pipe';
22+
import { UUIDService } from '../../../../../../core/shared/uuid.service';
2223

2324
describe('SearchFacetOptionComponent', () => {
2425
let comp: SearchFacetOptionComponent;
@@ -113,7 +114,8 @@ describe('SearchFacetOptionComponent', () => {
113114
}
114115
/* eslint-enable no-empty, @typescript-eslint/no-empty-function */
115116
}
116-
}
117+
},
118+
{ provide: UUIDService, useClass: UUIDService },
117119
],
118120
schemas: [NO_ERRORS_SCHEMA]
119121
}).overrideComponent(SearchFacetOptionComponent, {

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
@@ -5401,4 +5401,6 @@
54015401
"register-page.registration.aria.label": "Enter your e-mail address",
54025402

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

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)