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
Dropdown does not work properly in the Shadow DOM #35897
Comments
I've updated the CodeSandbox to include all broken components, which are: Dropdown, |
Your workaround is reasonable, and you can config this with ConfigProvider. |
I ran into this issue and was able to resolve this by using a ref from the parent component
|
or const shadowRoot = root.attachShadow({ mode: 'open' })
...
<ConfigProvider>
...
getPopupContainer={(node) => {
return shadowRoot
}}
</ConfigProvider> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reproduction link
Steps to reproduce
Click each dropdown/trigger twice and observe the open/closing effect.
What is expected?
It is expected for the dropdown in the web component to open on the first click and close on the 2nd click
What is actually happening?
The dropdown in the web component is opening on the first click, and closing of the 2nd mouse-down, and reopening on the following mouse-up.
The actual problem lies in
rc-trigger
, which is used byrc-dropdown
which Ant Design uses for it'sDropdown
component. It tries to reference the root of the element by usingelement.ownerDocument
, which returns the#document
almost always, when in certain cases we would want it to return a#shadow-root
.My current workaround:
I'm using a prop that is eventually passed down to
rc-trigger
, though I do not think it is specified anywhere in the documentation that this is possible.The text was updated successfully, but these errors were encountered: