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

Detect target inside a shadow root for clickOutsideHandler #7744

Closed
wants to merge 6 commits into from

Conversation

ywsang
Copy link
Contributor

@ywsang ywsang commented Jul 29, 2020

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.

@Reinmar
Copy link
Member

Reinmar commented Jul 30, 2020

Thanks for the PR and the issue report. Do you think you'd be able to add a test to this PR?

@ywsang
Copy link
Contributor Author

ywsang commented Jul 30, 2020

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 ) ) ) {

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.

Copy link
Member

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.

@Reinmar Reinmar requested a review from pomek August 4, 2020 14:10
@pomek pomek self-assigned this Aug 5, 2020
@pomek
Copy link
Member

pomek commented Aug 5, 2020

Since I am not able to apply minor changes, I must close the PR and create another one.

image

@pomek
Copy link
Member

pomek commented Aug 5, 2020

=> #7779

@pomek pomek closed this Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detect target inside a shadow root for clickOutsideHandler
4 participants