File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
src/cdk/a11y/live-announcer Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -117,13 +117,16 @@ export class CdkAriaLive implements OnDestroy {
117
117
this . _subscription . unsubscribe ( ) ;
118
118
this . _subscription = null ;
119
119
}
120
- } else {
121
- if ( ! this . _subscription ) {
122
- this . _subscription = this . _ngZone . runOutsideAngular (
123
- ( ) => this . _contentObserver . observe ( this . _elementRef . nativeElement ) . subscribe (
124
- ( ) => this . _liveAnnouncer . announce (
125
- this . _elementRef . nativeElement . innerText , this . _politeness ) ) ) ;
126
- }
120
+ } else if ( ! this . _subscription ) {
121
+ this . _subscription = this . _ngZone . runOutsideAngular ( ( ) => {
122
+ return this . _contentObserver
123
+ . observe ( this . _elementRef . nativeElement )
124
+ . subscribe ( ( ) => {
125
+ // Note that we use textContent here, rather than innerText, in order to avoid a reflow.
126
+ const element = this . _elementRef . nativeElement ;
127
+ this . _liveAnnouncer . announce ( element . textContent , this . _politeness ) ;
128
+ } ) ;
129
+ } ) ;
127
130
}
128
131
}
129
132
private _politeness : AriaLivePoliteness = 'off' ;
You can’t perform that action at this time.
0 commit comments