Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Select Dropdown Positioning Issues in Closed Shadow DOM #8338

Open
@tuandang-diag

Description

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.2.6

Environment

System: OS: macOS CPU: (8) x64 Intel(R) Core(TM) i7 Memory: 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm Browsers: Chrome: 128.0.6613.84 npmPackages: ant-design-vue: ^4.2.6 => 4.2.6 vue: ^3.5.12 => 3.5.12

Reproduction link

https://vuecomponent.github.io/issue-helper/

Steps to reproduce

  1. Create a Vue app with Ant Design Vue Select component
  2. Mount the app inside a closed Shadow DOM
  3. Click on the Select dropdown
  4. Observe the dropdown position

What is expected?

The Select dropdown should position correctly below or above the trigger element, appearing within the viewport.

What is actually happening?

The dropdown renders with negative coordinates (e.g., left: -387px; top: -820px) and appears offscreen, making it unusable.


This issue occurs specifically when using Ant Design Vue components inside a closed Shadow DOM, which is common in micro-frontend architectures. The positioning calculation logic doesn't account for the Shadow DOM boundary, causing coordinate system mismatch.

Code example:

<!-- HTML Setup -->
<!DOCTYPE html>
<html>
<body>
<div id="shadow-host"></div>
<script type="module">
const shadowHost = document.getElementById('shadow-host')
const shadowRoot = shadowHost.attachShadow({ mode: 'closed' })
shadowRoot.innerHTML = '<div id="app"></div>'
// Mount Vue app here
</script>
</body>
</html>
<!-- Vue Component -->
<template>
<ConfigProvider :get-popup-container="getPopupContainer">
<Select v-model:value="selectedValue" placeholder="Select an option" :options="options" />
</ConfigProvider>
</template>
<script setup>
import { Select, ConfigProvider } from 'ant-design-vue'
import { ref } from 'vue'

const selectedValue = ref(undefined)
const options = [
{ label: 'Option 1', value: '1' },
{ label: 'Option 2', value: '2' },
{ label: 'Option 3', value: '3' },
]

const getPopupContainer = (triggerNode) => {
// This doesn't work properly in closed Shadow DOM
return document.body
}
</script>

Error in console (if any):

No console errors, but dropdown positioning is incorrect with negative coordinates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /