fix(stepper): reading out wrong amount of options with NVDA on Firefox (#11711)

Fixes NVDA on Firefox reading out "Tab 1 of 1" for vertical steppers. Seems to be a similar issue to  #11694.
This commit is contained in:
Kristiyan Kostadinov
2018-06-12 18:54:21 +02:00
committed by Jeremy Elbourn
parent e95623d0c1
commit 56e703f1d4
3 changed files with 12 additions and 0 deletions
+2
View File
@@ -5,6 +5,8 @@
(keydown)="_onKeydown($event)"
[tabIndex]="_getFocusIndex() === i ? 0 : -1"
[id]="_getStepLabelId(i)"
[attr.aria-posinset]="i + 1"
[attr.aria-setsize]="_steps.length"
[attr.aria-controls]="_getStepContentId(i)"
[attr.aria-selected]="selectedIndex == i"
[index]="i"
+2
View File
@@ -4,6 +4,8 @@
(keydown)="_onKeydown($event)"
[tabIndex]="_getFocusIndex() == i ? 0 : -1"
[id]="_getStepLabelId(i)"
[attr.aria-posinset]="i + 1"
[attr.aria-setsize]="_steps.length"
[attr.aria-controls]="_getStepContentId(i)"
[attr.aria-selected]="selectedIndex === i"
[index]="i"
+8
View File
@@ -365,6 +365,14 @@ describe('MatStepper', () => {
expect(stepperComponent.selectedIndex).toBe(-1);
});
it('should set the correct aria-posinset and aria-setsize', () => {
const headers =
Array.from<HTMLElement>(fixture.nativeElement.querySelectorAll('.mat-step-header'));
expect(headers.map(header => header.getAttribute('aria-posinset'))).toEqual(['1', '2', '3']);
expect(headers.every(header => header.getAttribute('aria-setsize') === '3')).toBe(true);
});
});
describe('icon overrides', () => {