-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(cdk/overlay): skip trigger interactions in outside click event #29044
Conversation
const origin = this._getOriginElement(); | ||
const target = _getEventTarget(event) as Element | null; | ||
|
||
if (!target || !origin || (origin !== target && !origin.contains(target))) { |
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.
nit: the null checks appear to be redundant since contains
returns false if target
is null. This could be reduced to origin !== target && !origin?.contains(target))
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'll get rid of the target
check, but I'll leave in the one for origin
since I don't want to end up comparing nulls.
Adds some logic to skip the trigger when considering clicks outside of the overlay since filtering them is the most common case (e.g. we do it in some of our components) and can be annoying to deal with. Fixes angular#28949.
68d7028
to
b868d9e
Compare
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. |
Adds some logic to skip the trigger when considering clicks outside of the overlay since filtering them is the most common case (e.g. we do it in some of our components) and can be annoying to deal with.
Fixes #28949.