@@ -1014,6 +1014,15 @@ describe('MatStepper', () => {
10141014 expect ( headers [ 2 ] . classList . contains ( 'mat-primary' ) ) . toBe ( true ) ;
10151015 expect ( headers [ 1 ] . classList . contains ( 'mat-accent' ) ) . toBe ( true ) ;
10161016 } ) ;
1017+
1018+ it ( 'should set an aria label on the content container' , ( ) => {
1019+ const fixture = createComponent ( SimpleMatVerticalStepperApp ) ;
1020+ fixture . componentInstance . ariaLabel . set ( 'My Stepper' ) ;
1021+ fixture . detectChanges ( ) ;
1022+
1023+ const container = fixture . nativeElement . querySelector ( '.mat-vertical-content-container' ) ;
1024+ expect ( container . getAttribute ( 'aria-label' ) ) . toBe ( 'My Stepper' ) ;
1025+ } ) ;
10171026 } ) ;
10181027
10191028 describe ( 'horizontal stepper' , ( ) => {
@@ -1214,6 +1223,17 @@ describe('MatStepper', () => {
12141223
12151224 expect ( stepperHost . classList ) . toContain ( 'mat-stepper-header-position-bottom' ) ;
12161225 } ) ;
1226+
1227+ it ( 'should set an aria-label on the header container' , ( ) => {
1228+ const fixture = createComponent ( SimpleMatHorizontalStepperApp ) ;
1229+ fixture . componentInstance . ariaLabel . set ( 'My Stepper' ) ;
1230+ fixture . detectChanges ( ) ;
1231+
1232+ const container = fixture . nativeElement . querySelector (
1233+ '.mat-horizontal-stepper-header-container' ,
1234+ ) ;
1235+ expect ( container . getAttribute ( 'aria-label' ) ) . toBe ( 'My Stepper' ) ;
1236+ } ) ;
12171237 } ) ;
12181238
12191239 describe ( 'linear stepper with valid step' , ( ) => {
@@ -1845,7 +1865,8 @@ class MatHorizontalStepperWithErrorsApp {
18451865 <mat-stepper
18461866 [disableRipple]="disableRipple()"
18471867 [color]="stepperTheme()"
1848- [headerPosition]="headerPosition()">
1868+ [headerPosition]="headerPosition()"
1869+ [aria-label]="ariaLabel()">
18491870 <mat-step>
18501871 <ng-template matStepLabel>Step 1</ng-template>
18511872 Content 1
@@ -1876,6 +1897,7 @@ class MatHorizontalStepperWithErrorsApp {
18761897class SimpleMatHorizontalStepperApp {
18771898 @ViewChild ( MatStepper ) stepper ! : MatStepper ;
18781899 inputLabel = 'Step 3' ;
1900+ ariaLabel = signal < string | null > ( null ) ;
18791901 disableRipple = signal ( false ) ;
18801902 stepperTheme = signal < ThemePalette > ( undefined ) ;
18811903 secondStepTheme = signal < ThemePalette > ( undefined ) ;
@@ -1884,7 +1906,7 @@ class SimpleMatHorizontalStepperApp {
18841906
18851907@Component ( {
18861908 template : `
1887- <mat-stepper orientation="vertical" [disableRipple]="disableRipple()" [color]="stepperTheme()">
1909+ <mat-stepper orientation="vertical" [disableRipple]="disableRipple()" [color]="stepperTheme()" [aria-label]="ariaLabel()" >
18881910 <mat-step>
18891911 <ng-template matStepLabel>Step 1</ng-template>
18901912 Content 1
@@ -1917,6 +1939,7 @@ class SimpleMatHorizontalStepperApp {
19171939class SimpleMatVerticalStepperApp {
19181940 @ViewChild ( MatStepper ) stepper ! : MatStepper ;
19191941 inputLabel = signal ( 'Step 3' ) ;
1942+ ariaLabel = signal < string | null > ( null ) ;
19201943 showStepTwo = signal ( true ) ;
19211944 disableRipple = signal ( false ) ;
19221945 stepperTheme = signal < ThemePalette > ( undefined ) ;
0 commit comments