Skip to content

Commit d0b5e04

Browse files
committed
fix(material/stepper): assistive technology reading out stepper icon
Fixes that the text inside the icon was being read out when the user interacts with the stepper header using assistive technology.
1 parent 39921f4 commit d0b5e04

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/material/stepper/step-header.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
[matRippleTrigger]="_getHostElement()"
33
[matRippleDisabled]="disableRipple"></div>
44

5-
<div class="mat-step-icon-state-{{state}} mat-step-icon" [class.mat-step-icon-selected]="selected">
5+
<div
6+
class="mat-step-icon-state-{{state}} mat-step-icon"
7+
[class.mat-step-icon-selected]="selected"
8+
aria-hidden="true">
69
<div class="mat-step-icon-content" [ngSwitch]="!!(iconOverrides && iconOverrides[state])">
710
<ng-container
811
*ngSwitchCase="true"

src/material/stepper/stepper.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,11 @@ describe('MatStepper', () => {
444444
stepHeaderNativeElements.every(element => element.querySelector('.mat-focus-indicator')),
445445
).toBe(true);
446446
});
447+
448+
it('should hide the header icons from assistive technology', () => {
449+
const icon = fixture.nativeElement.querySelector('.mat-step-icon');
450+
expect(icon.getAttribute('aria-hidden')).toBe('true');
451+
});
447452
});
448453

449454
describe('basic stepper when attempting to set the selected step too early', () => {

0 commit comments

Comments
 (0)