mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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:
committed by
Jeremy Elbourn
parent
e95623d0c1
commit
56e703f1d4
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user