|
11 | 11 | @switch (orientation) {
|
12 | 12 | @case ('horizontal') {
|
13 | 13 | <div class="mat-horizontal-stepper-wrapper">
|
14 |
| - <div class="mat-horizontal-stepper-header-container"> |
| 14 | + <div class="mat-horizontal-stepper-header-container" role="tablist"> |
15 | 15 | @for (step of steps; track step) {
|
16 | 16 | <ng-container
|
17 | 17 | [ngTemplateOutlet]="stepTemplate"
|
|
40 | 40 | }
|
41 | 41 |
|
42 | 42 | @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"/> |
| 43 | + <div class="mat-vertical-stepper-wrapper" role="group"> |
| 44 | + @for (step of steps; track step) { |
| 45 | + <div class="mat-step" role="group"> |
| 46 | + <ng-container |
| 47 | + [ngTemplateOutlet]="stepTemplate" |
| 48 | + [ngTemplateOutletContext]="{step, i: $index}"/> |
| 49 | + <div |
| 50 | + #animatedContainer |
| 51 | + class="mat-vertical-content-container" |
| 52 | + [class.mat-stepper-vertical-line]="!$last" |
| 53 | + [class.mat-vertical-content-container-active]="selectedIndex === $index" |
| 54 | + [attr.inert]="selectedIndex === $index ? null : ''"> |
| 55 | + <div class="mat-vertical-stepper-content" |
| 56 | + role="region" |
| 57 | + [id]="_getStepContentId($index)" |
| 58 | + [attr.aria-labelledby]="_getStepLabelId($index)"> |
| 59 | + <div class="mat-vertical-content"> |
| 60 | + <ng-container [ngTemplateOutlet]="step.content"/> |
| 61 | + </div> |
60 | 62 | </div>
|
61 | 63 | </div>
|
62 | 64 | </div>
|
63 |
| - </div> |
64 |
| - } |
| 65 | + } |
| 66 | + </div> |
65 | 67 | }
|
66 | 68 | }
|
67 | 69 |
|
|
70 | 72 | <mat-step-header
|
71 | 73 | [class.mat-horizontal-stepper-header]="orientation === 'horizontal'"
|
72 | 74 | [class.mat-vertical-stepper-header]="orientation === 'vertical'"
|
| 75 | + [attr.role]="orientation === 'horizontal' ? 'tab' : 'button'" |
73 | 76 | (click)="step.select()"
|
74 | 77 | (keydown)="_onKeydown($event)"
|
75 | 78 | [tabIndex]="_getFocusIndex() === i ? 0 : -1"
|
76 | 79 | [id]="_getStepLabelId(i)"
|
77 |
| - [attr.aria-posinset]="i + 1" |
78 |
| - [attr.aria-setsize]="steps.length" |
79 |
| - [attr.aria-controls]="_getStepContentId(i)" |
80 |
| - [attr.aria-selected]="selectedIndex == i" |
81 |
| - [attr.aria-label]="step.ariaLabel || null" |
| 80 | + [attr.aria-posinset]="orientation === 'horizontal' ? i + 1 : undefined" |
| 81 | + [attr.aria-setsize]="orientation === 'horizontal' ? steps.length : undefined" |
| 82 | + [attr.aria-controls]="orientation === 'horizontal' ? _getStepContentId(i) : undefined" |
| 83 | + [attr.aria-selected]="orientation === 'horizontal' ? selectedIndex == i : undefined" |
| 84 | + [attr.aria-current]="orientation === 'vertical' ? selectedIndex == i : undefined" |
| 85 | + [attr.aria-label]="step.ariaLabel || `Step ${i+1}`" |
82 | 86 | [attr.aria-labelledby]="(!step.ariaLabel && step.ariaLabelledby) ? step.ariaLabelledby : null"
|
83 | 87 | [attr.aria-disabled]="_stepIsNavigable(i, step) ? null : true"
|
84 | 88 | [index]="i"
|
|
0 commit comments