Skip to content

Commit

Permalink
fix(angular/processflow): remove obsolete aria-expanded attribute (#1623
Browse files Browse the repository at this point in the history
)

The `aria-expanded` attribute is not valid for the `tabpanel` role (see e.g. [here](https://www.w3.org/TR/wai-aria-1.2/#tabpanel)). It can be simply removed because selecting the tab with `aria-selected` in combination with an `aria-controls` pointing to the `tabpanel` is already enough.
  • Loading branch information
mhaertwig authored Jul 27, 2022
1 parent 100ecc3 commit c6aad0b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/angular/processflow/processflow.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
(@stepTransition.done)="_animationDone.next($event)"
[id]="_getStepContentId(i)"
[attr.aria-labelledby]="_getStepLabelId(i)"
[attr.aria-expanded]="selectedIndex === i"
>
<ng-container [ngTemplateOutlet]="step.content"></ng-container>
</div>
Expand Down
16 changes: 0 additions & 16 deletions src/angular/processflow/processflow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,6 @@ describe('SbbProcessflow', () => {
expect(processflowEl.getAttribute('role')).toBe('tablist');
});

it('should set aria-expanded of content correctly', () => {
const stepContents = fixture.debugElement.queryAll(By.css(`.sbb-processflow-content`));
const processflowComponent = fixture.debugElement.query(
By.directive(SbbProcessflow)
)!.componentInstance;
const firstStepContentEl = stepContents[0].nativeElement;
expect(firstStepContentEl.getAttribute('aria-expanded')).toBe('true');

processflowComponent.selectedIndex = 1;
fixture.detectChanges();

expect(firstStepContentEl.getAttribute('aria-expanded')).toBe('false');
const secondStepContentEl = stepContents[1].nativeElement;
expect(secondStepContentEl.getAttribute('aria-expanded')).toBe('true');
});

it('should display the correct label', () => {
const processflowComponent = fixture.debugElement.query(
By.directive(SbbProcessflow)
Expand Down

0 comments on commit c6aad0b

Please sign in to comment.