File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/cdk/a11y/live-announcer Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -118,10 +118,15 @@ export class CdkAriaLive implements OnDestroy {
118118 this . _subscription = null ;
119119 }
120120 } else if ( ! this . _subscription ) {
121- this . _subscription = this . _ngZone . runOutsideAngular (
122- ( ) => this . _contentObserver . observe ( this . _elementRef ) . subscribe (
123- ( ) => this . _liveAnnouncer . announce (
124- this . _elementRef . nativeElement . innerText , this . _politeness ) ) ) ;
121+ this . _subscription = this . _ngZone . runOutsideAngular ( ( ) => {
122+ return this . _contentObserver
123+ . observe ( this . _elementRef )
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+ } ) ;
125130 }
126131 }
127132 private _politeness : AriaLivePoliteness = 'off' ;
You can’t perform that action at this time.
0 commit comments