File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -63,5 +63,8 @@ export class MdDialogConfig {
63
63
/** Layout direction for the dialog's content. */
64
64
direction ?: Direction = 'ltr' ;
65
65
66
+ /** ID of the element that describes the dialog. */
67
+ ariaDescribedBy ?: string | null = null ;
68
+
66
69
// TODO(jelbourn): add configuration for lifecycle hooks, ARIA labelling.
67
70
}
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ export function throwMdDialogContentAlreadyAttachedError() {
67
67
'class' : 'mat-dialog-container' ,
68
68
'[attr.role]' : '_config?.role' ,
69
69
'[attr.aria-labelledby]' : '_ariaLabelledBy' ,
70
+ '[attr.aria-describedby]' : '_config?.ariaDescribedBy || null' ,
70
71
'[@slideDialog]' : '_state' ,
71
72
'(@slideDialog.done)' : '_onAnimationDone($event)' ,
72
73
} ,
Original file line number Diff line number Diff line change @@ -117,6 +117,15 @@ describe('MdDialog', () => {
117
117
expect ( dialogContainerElement . getAttribute ( 'role' ) ) . toBe ( 'alertdialog' ) ;
118
118
} ) ;
119
119
120
+ it ( 'should apply the specified `aria-describedby`' , ( ) => {
121
+ dialog . open ( PizzaMsg , { ariaDescribedBy : 'description-element' } ) ;
122
+
123
+ viewContainerFixture . detectChanges ( ) ;
124
+
125
+ let dialogContainerElement = overlayContainerElement . querySelector ( 'md-dialog-container' ) ! ;
126
+ expect ( dialogContainerElement . getAttribute ( 'aria-describedby' ) ) . toBe ( 'description-element' ) ;
127
+ } ) ;
128
+
120
129
it ( 'should close a dialog and get back a result' , async ( ( ) => {
121
130
let dialogRef = dialog . open ( PizzaMsg , { viewContainerRef : testViewContainerRef } ) ;
122
131
let afterCloseCallback = jasmine . createSpy ( 'afterClose callback' ) ;
@@ -666,7 +675,7 @@ describe('MdDialog', () => {
666
675
} ) ;
667
676
} ) ) ;
668
677
669
- it ( 'should set the aria-labelled by attribute to the id of the title' , async ( ( ) => {
678
+ it ( 'should set the aria-labelledby attribute to the id of the title' , async ( ( ) => {
670
679
let title = overlayContainerElement . querySelector ( '[md-dialog-title]' ) ! ;
671
680
let container = overlayContainerElement . querySelector ( 'md-dialog-container' ) ! ;
672
681
You can’t perform that action at this time.
0 commit comments