Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@if (active$ | async) {
<div class="facet-filter d-block mb-3 p-3"
[id]="regionId" [attr.aria-labelledby]="toggleId" [ngClass]="{ 'focus': focusBox }" role="region">
[id]="regionId" [attr.aria-labelledby]="toggleId" [ngClass]="{ 'focus': focusBox }">
<button (click)="toggle()" (focusin)="focusBox = true" (focusout)="focusBox = false"
class="filter-name d-flex" [attr.aria-controls]="regionId" [id]="toggleId"
[attr.aria-expanded]="(collapsed$ | async) !== true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
TestBed,
waitForAsync,
} from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { RouterModule } from '@angular/router';
import { AppliedFilter } from '@dspace/core/shared/search/models/applied-filter.model';
Expand Down Expand Up @@ -94,6 +95,11 @@ describe('SearchFilterComponent', () => {
expect(comp.regionId).toContain('17');
});

it('should not expose individual facet filter as a region landmark', () => {
const facetFilterElement = fixture.debugElement.query(By.css('.facet-filter'));
expect(facetFilterElement.attributes.role).not.toBe('region');
});

describe('when the toggle method is triggered', () => {
beforeEach(() => {
spyOn(searchFilterService, 'toggle');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<section [attr.aria-label]="filterLabel + '.filters.head' | translate">

@if (inPlaceSearch) {
<h3>{{filterLabel+'.filters.head' | translate}}</h3>
} @else {
Expand All @@ -21,4 +23,4 @@ <h2>{{filterLabel+'.filters.head' | translate}}</h2>
<i class="fas fa-undo"></i> {{"search.filters.reset" | translate}}
</button>
}

</section>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
TestBed,
waitForAsync,
} from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { RouterModule } from '@angular/router';
import { APP_CONFIG } from '@dspace/config/app-config.interface';
Expand Down Expand Up @@ -68,4 +69,12 @@ describe('SearchFiltersComponent', () => {
});
});

describe('accessibility', () => {
it('should render a section landmark with an accessible aria-label', () => {
const sectionElement = fixture.debugElement.query(By.css('section'));
expect(sectionElement).toBeTruthy();
expect(sectionElement.attributes['aria-label']).toBeTruthy();
});
});

});
Loading