-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(focus-monitor): don't null-out focus until after event is finished with capture & bubble #10721
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
|
||
// Null-out the origin after a setTimeout. This allows the full capture/bubble cycle to complete | ||
// for the current event before nulling it. | ||
setTimeout(() => this._origin = null); |
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.
Could this be run outside the zone?
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.
It already is since this happens inside a listener that's outside the zone
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
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
|
||
// Null-out the origin after a setTimeout. This allows the full capture/bubble cycle to complete | ||
// for the current event before nulling it. | ||
setTimeout(() => this._origin = null); |
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.
You could avoid breaking a bunch of tests by using a Promise.resolve().then(...)
rather than the timeout. It does make it harder to flush though.
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 tried, it doesn't wait long enough. Looks like it has to be setTimeout
0a5f3bf
to
31c19ce
Compare
Hi @mmalerba! This PR has merge conflicts due to recent upstream merges. |
…d with capture & bubble (#10721)
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. |
This fixes an issue where putting
cdkMonitorSubtreeFocus
on a child withcdkMonitorElementFocus
causes the focus origin to be lost for the child element, due to the parent element nulling it out too soon.