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

Click-away (close on outside click) does not work in ShadowDom for action "click" #382

Open
Psvensso opened this issue May 11, 2023 · 0 comments

Comments

@Psvensso
Copy link

When using the popover from Antd in a WebComponent with the "click" action the "click away" does not work, the popover is never closed. When clicking on the trigger button the popover is closed.

<Popover content={<div>demo</div>} title="Title" trigger="click">
 <Button>Click me</Button>
</Popover>

Expected:
Clicking on anything other than the popover content or the trigger (button in this case) the popover should close.

Actuall:
The popover is not closed.

Findings:
When using a popover from Antd inside a ShadoDom and using the trigger "click" the inPopupOrChild incorrectly thinks the mousedown/click is inside the content. There is something wrong in the checking of inPopupOrChild. The event retargeting makes the event come from the webcomponent and somehow the trigger thinks this is inside the content.

Workaround:
Catch the onMouseDown event in the webcomponent ctor and stop the bubbling with stopPropagation stops the event from reaching the global listener a second time.

Repro:
https://codesandbox.io/p/sandbox/elated-keldysh-vgwylx?file=%2Fsrc%2FApp.tsx%3A27%2C21

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

No branches or pull requests

1 participant