Skip to content

Commit 3cb4375

Browse files
committed
fix(material/stepper): fix nested tabpanel role in stepper
Updates Angular Components Stepper component to fix the nested aria-role tabpanel in the vertical stepper. Fixes b/361783174
1 parent 9ea468a commit 3cb4375

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

src/material/stepper/step-header.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import {_CdkPrivateStyleLoader, _VisuallyHiddenLoader} from '@angular/cdk/privat
3535
host: {
3636
'class': 'mat-step-header',
3737
'[class]': '"mat-" + (color || "primary")',
38-
'role': 'tab',
3938
},
4039
encapsulation: ViewEncapsulation.None,
4140
changeDetection: ChangeDetectionStrategy.OnPush,

src/material/stepper/stepper.html

+22-20
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
@switch (orientation) {
1212
@case ('horizontal') {
1313
<div class="mat-horizontal-stepper-wrapper">
14-
<div class="mat-horizontal-stepper-header-container">
14+
<div class="mat-horizontal-stepper-header-container" role="tablist">
1515
@for (step of steps; track step) {
1616
<ng-container
17+
role="tab"
1718
[ngTemplateOutlet]="stepTemplate"
1819
[ngTemplateOutletContext]="{step, i: $index}"/>
1920
@if (!$last) {
@@ -40,28 +41,29 @@
4041
}
4142

4243
@case ('vertical') {
43-
@for (step of steps; track step) {
44-
<div class="mat-step">
45-
<ng-container
46-
[ngTemplateOutlet]="stepTemplate"
47-
[ngTemplateOutletContext]="{step, i: $index}"/>
48-
<div
49-
#animatedContainer
50-
class="mat-vertical-content-container"
51-
[class.mat-stepper-vertical-line]="!$last"
52-
[class.mat-vertical-content-container-active]="selectedIndex === $index"
53-
[attr.inert]="selectedIndex === $index ? null : ''">
54-
<div class="mat-vertical-stepper-content"
55-
role="tabpanel"
56-
[id]="_getStepContentId($index)"
57-
[attr.aria-labelledby]="_getStepLabelId($index)">
58-
<div class="mat-vertical-content">
59-
<ng-container [ngTemplateOutlet]="step.content"/>
44+
<div class="mat-vertical-stepper-wrapper" role="tree">
45+
@for (step of steps; track step) {
46+
<div class="mat-step" role="treeitem">
47+
<ng-container
48+
[ngTemplateOutlet]="stepTemplate"
49+
[ngTemplateOutletContext]="{step, i: $index}"/>
50+
<div
51+
#animatedContainer
52+
class="mat-vertical-content-container"
53+
[class.mat-stepper-vertical-line]="!$last"
54+
[class.mat-vertical-content-container-active]="selectedIndex === $index"
55+
[attr.inert]="selectedIndex === $index ? null : ''">
56+
<div class="mat-vertical-stepper-content"
57+
[id]="_getStepContentId($index)"
58+
[attr.aria-labelledby]="_getStepLabelId($index)">
59+
<div class="mat-vertical-content">
60+
<ng-container [ngTemplateOutlet]="step.content"/>
61+
</div>
6062
</div>
6163
</div>
6264
</div>
63-
</div>
64-
}
65+
}
66+
</div>
6567
}
6668
}
6769

src/material/stepper/stepper.ts

-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ export class MatStep extends CdkStep implements ErrorStateMatcher, AfterContentI
132132
'[class.mat-stepper-animating]': '_isAnimating()',
133133
'[style.--mat-stepper-animation-duration]': '_getAnimationDuration()',
134134
'[attr.aria-orientation]': 'orientation',
135-
'role': 'tablist',
136135
},
137136
providers: [{provide: CdkStepper, useExisting: MatStepper}],
138137
encapsulation: ViewEncapsulation.None,

0 commit comments

Comments
 (0)