File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
src/cdk/a11y/live-announcer Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ describe('CdkAriaLive', () => {
128
128
providers : [ {
129
129
provide : MutationObserverFactory ,
130
130
useValue : {
131
- create : function ( callback : Function ) {
131
+ create : ( callback : Function ) => {
132
132
mutationCallbacks . push ( callback ) ;
133
133
134
134
return {
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ export class LiveAnnouncer implements OnDestroy {
95
95
selector : '[cdkAriaLive]'
96
96
} )
97
97
export class CdkAriaLive implements OnDestroy {
98
+ /** The aria-live politeness level to use when announcing messages. */
98
99
@Input ( 'cdkAriaLive' )
99
100
get politeness ( ) : AriaLivePoliteness { return this . _politeness ; }
100
101
set politeness ( value : AriaLivePoliteness ) {
@@ -105,10 +106,12 @@ export class CdkAriaLive implements OnDestroy {
105
106
this . _subscription = null ;
106
107
}
107
108
} else {
108
- this . _subscription = this . _ngZone . runOutsideAngular (
109
- ( ) => this . _contentObserver . observe ( this . _elementRef . nativeElement ) . subscribe (
110
- ( ) => this . _liveAnnouncer . announce (
111
- this . _elementRef . nativeElement . innerText , this . _politeness ) ) ) ;
109
+ if ( ! this . _subscription ) {
110
+ this . _subscription = this . _ngZone . runOutsideAngular (
111
+ ( ) => this . _contentObserver . observe ( this . _elementRef . nativeElement ) . subscribe (
112
+ ( ) => this . _liveAnnouncer . announce (
113
+ this . _elementRef . nativeElement . innerText , this . _politeness ) ) ) ;
114
+ }
112
115
}
113
116
}
114
117
private _politeness : AriaLivePoliteness = 'off' ;
You can’t perform that action at this time.
0 commit comments