Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
robmv opened this issue Feb 20, 2025 · 0 comments
Labels
area: cdk/a11y docs This issue is related to documentation P4 A relatively minor issue that is not relevant to core functions

Comments

@robmv
Copy link

robmv commented Feb 20, 2025

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

@robmv robmv added docs This issue is related to documentation needs triage This issue needs to be triaged by the team labels Feb 20, 2025
@robmv robmv changed the title docs-bug(FocusMonitor): Emits outside NgZone in implementation but docs states otherwise docs-bug(FocusMonitor): Emits inside NgZone in implementation but docs states otherwise Feb 20, 2025
@crisbeto crisbeto added P4 A relatively minor issue that is not relevant to core functions area: cdk/a11y and removed needs triage This issue needs to be triaged by the team labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cdk/a11y docs This issue is related to documentation P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

No branches or pull requests

2 participants