-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Detect target inside a shadow root for clickOutsideHandler #7744
Conversation
Thanks for the PR and the issue report. Do you think you'd be able to add a test to this PR? |
I'll look into it! |
if ( !activator() ) { | ||
return; | ||
} | ||
|
||
for ( const contextElement of contextElements ) { | ||
if ( contextElement.contains( target ) ) { | ||
if ( contextElement.contains( domEvt.target ) || | ||
( 'composedPath' in domEvt && domEvt.composedPath().includes( contextElement ) ) ) { |
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.
Maybe add a comment on why you're checking for the existence of composedPath
. I'm not sure how this project tracks browser support, but they may want to remove then when all supported browsers have native shadow DOM.
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.
A comment would great! We don't unfortunately track such things in a more organized way yet, so a comment is the best we can do for now.
=> #7779 |
Suggested merge commit message (convention)
Other (ui): Look at event's composed path to detect a target in shadow root. Closes #7743.
Additional information
For example – encountered issues, assumptions you had to make, other affected tickets, etc.