Skip to content

Commit b38b966

Browse files
crisbetojelbourn
authored andcommitted
fix(focus-monitor): hitting ngzone when using focusVia (#10608)
Currently most of the timeouts inside the `FocusMonitor` are run outside the `NgZone`, because they're called from event listeners that are bound on the outside, however the one from `_setOriginForCurrentEventQueue` can still end up inside when it's called by `focusVia`.
1 parent 46ca6ce commit b38b966

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cdk/a11y/focus-monitor/focus-monitor.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,10 @@ export class FocusMonitor implements OnDestroy {
240240
* @param origin The origin to set.
241241
*/
242242
private _setOriginForCurrentEventQueue(origin: FocusOrigin): void {
243-
this._origin = origin;
244-
this._originTimeoutId = setTimeout(() => this._origin = null, 0);
243+
this._ngZone.runOutsideAngular(() => {
244+
this._origin = origin;
245+
this._originTimeoutId = setTimeout(() => this._origin = null, 0);
246+
});
245247
}
246248

247249
/**

0 commit comments

Comments
 (0)