修复弹出内容跟随屏幕滚动的问题 - v2 by cyfung1031 · Pull Request #1263 · scriptscat/scriptcat
Expand Up
@@ -295,14 +295,18 @@ const MainLayout: React.FC<{
}}
locale={arcoLocale(i18n.language)}
componentConfig={{
Popconfirm: {
Select: {
getPopupContainer: (node) => {
return node.parentNode as Element;
return node;
},
},
}}
getPopupContainer={(node) => {
return node;
let p = node.parentNode as Element;
p = (p.closest("button")?.parentNode as Element) || p; // 確保 ancestor 沒有 button 元素
p = (p.closest("span")?.parentNode as Element) || p; // 確保 ancestor 沒有 span 元素
p = (p.closest("aside")?.parentNode as Element) || p; // 確保 ancestor 沒有 aside 元素
return p;
}}
>
{contextHolder}
Expand Down