Skip to content

docs-bug(FocusMonitor): Emits inside NgZone in implementation but docs states otherwise #30529

@robmv

Description

@robmv

Documentation Feedback

Checking the implementation, I observe that the FocusMonitor emits inside NgZone:

private _emitOrigin(info: MonitoredElementInfo, origin: FocusOrigin) {
if (info.subject.observers.length) {
this._ngZone.run(() => info.subject.next(origin));
}
}

And confirmed checking NgZone.isInAngularZone() in a subscription.

But documentations says:

Note: currently the FocusMonitor emits on the observable outside of the Angular zone. Therefore, if you markForCheck in the subscription you must put yourself back in the Angular zone.

Affected documentation page

https://material.angular.io/cdk/a11y/overview#focusmonitor

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functionsarea: cdk/a11ydocsThis issue is related to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions