File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
src/cdk-experimental/dialog Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ export class CdkDialogContainer extends BasePortalOutlet implements OnDestroy {
82
82
/** The class that traps and manages focus within the dialog. */
83
83
private _focusTrap = this . _focusTrapFactory . create ( this . _elementRef . nativeElement , false ) ;
84
84
85
- // @HostBinding is used in the class as it is expected to be extended. Since @Component decorator
85
+ // @HostBinding is used in the class as it is expected to be extended. Since @Component decorator
86
86
// metadata is not inherited by child classes, instead the host binding data is defined in a way
87
87
// that can be inherited.
88
88
// tslint:disable:no-host-decorator-in-concrete
@@ -93,6 +93,8 @@ export class CdkDialogContainer extends BasePortalOutlet implements OnDestroy {
93
93
94
94
@HostBinding ( 'attr.role' ) get _role ( ) { return this . _config . role ; }
95
95
96
+ @HostBinding ( 'attr.aria-modal' ) _ariaModal = true ;
97
+
96
98
@HostBinding ( 'attr.tabindex' ) get _tabindex ( ) { return - 1 ; }
97
99
// tslint:disable:no-host-decorator-in-concrete
98
100
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ describe('Dialog', () => {
79
79
viewContainerFixture . detectChanges ( ) ;
80
80
let dialogContainerElement = overlayContainerElement . querySelector ( 'cdk-dialog-container' ) ! ;
81
81
expect ( dialogContainerElement . getAttribute ( 'role' ) ) . toBe ( 'dialog' ) ;
82
+ expect ( dialogContainerElement . getAttribute ( 'aria-modal' ) ) . toBe ( 'true' ) ;
82
83
} ) ;
83
84
84
85
it ( 'should open a dialog with a template' , ( ) => {
@@ -100,6 +101,7 @@ describe('Dialog', () => {
100
101
101
102
let dialogContainerElement = overlayContainerElement . querySelector ( 'cdk-dialog-container' ) ! ;
102
103
expect ( dialogContainerElement . getAttribute ( 'role' ) ) . toBe ( 'dialog' ) ;
104
+ expect ( dialogContainerElement . getAttribute ( 'aria-modal' ) ) . toBe ( 'true' ) ;
103
105
104
106
dialogRef . close ( ) ;
105
107
} ) ;
You can’t perform that action at this time.
0 commit comments