-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Bug]: Popover not working inside Web Component #514
Comments
Update: I did some digging and I think the problem is with this line:
This line only checks what the active element is within the "root tree", but if the active element is inside a shadow tree, the whole custom element will be returned as the active element, and since that element does not live inside the popover panel, it concludes somewhere outside the panel is clicked on. The following article helped me in understanding this: https://dev.to/open-wc/mind-the-document-activeelement-2o9a Update #2: It could also be related to the way the target of the mousedown is determined:
Now, |
I can confirm that. The modal is rendered on document root instead of shadow root. |
@herodrigues I'm also trying to render to shadow root. I'm actually trying to do this with the Dialog component. |
I'm having the same problem with the Menu component inside a shadow root. Clicks on the items work fine but when trying to select an item by focus it doesn't work.
Using |
@zawilliams my "solution" was not to use any modal component. Instead, I replaced every modal with a normal div and emulated the modal behaviour; |
Hey! Thank you for your bug report! We currently don't have web components support, but I captured this in a separate discussion so that we can clean things up. Discussion: #874 |
What package within Headless UI are you using?
@headlessui/react
What version of that package are you using?
1.2.0
What browser are you using?
Chrome
Reproduction repository
None
Describe your issue
When using popover inside a web component, the popover panel closes even when you click inside the panel. I am using the most minimal example of the docs. When I pull this code outside my web component into my "root" react application, it works as expected.
Used code:
When using this code inside my web component, clicking inside the panel will close the popover.
The text was updated successfully, but these errors were encountered: