-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(focus-monitor): cleanup global listeners and don't require Renderer2 #7728
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
Conversation
src/cdk/a11y/focus-monitor.spec.ts
Outdated
spyOn(window, 'addEventListener').and.callThrough(); | ||
spyOn(window, 'removeEventListener').and.callThrough(); | ||
spyOn(document, 'addEventListener').and.callThrough(); | ||
spyOn(document, 'removeEventListener').and.callThrough(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will permanently make these things spies for the rest of the test run; I'm not sure there's a good way to test global listener deregistration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe they are automatically cleaned up at the end of the describe block. There's some discussion about it here: jasmine/jasmine#1281
src/cdk/a11y/focus-monitor.ts
Outdated
private _unregisterGlobalListeners = () => {}; | ||
|
||
/** The number of elements currently being monitored. */ | ||
private get _monitoredElementCount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is private, use functions instead of a getter/setter?
renderer: Renderer2 | boolean, | ||
checkChildren?: boolean): Observable<FocusOrigin> { | ||
// TODO(mmalerba): clean up after deprecated signature is removed. | ||
if (!(renderer instanceof Renderer2)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add this to the google cleanups tracker?
comments addressed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Needs rebase. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
fixes #7609