Skip to content

Commit

Permalink
Accessibility when selecting a search filter (#3385)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Jan 29, 2025
1 parent 6916483 commit f262299
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ 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';

import { PaginationService } from '../../../../../../core/pagination/pagination.service';
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';
Expand Down Expand Up @@ -75,6 +79,8 @@ export class SearchFacetOptionComponent implements OnInit {
protected searchConfigService: SearchConfigurationService,
protected router: Router,
protected paginationService: PaginationService,
protected liveRegionService: LiveRegionService,
private translateService: TranslateService,
) {
}

Expand Down Expand Up @@ -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);
}
}
2 changes: 2 additions & 0 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
}
5 changes: 3 additions & 2 deletions src/assets/i18n/es.json5
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
}
3 changes: 3 additions & 0 deletions src/assets/i18n/pt-BR.json5
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
}

0 comments on commit f262299

Please sign in to comment.