Skip to content

Conversation

@RylanBot
Copy link
Collaborator

@RylanBot RylanBot commented Oct 27, 2025

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

💡 需求背景和解决方案

PopperJS 定位逻辑:寻找一个使用了 position: relative / absolute / fixed 的父元素 / 祖先元素,作为 offsetParent,即一个参考点,用来计算偏移量。

  • 没给 wrapper / portal 添加绝对定位前,Popper 找到的参考点是 body,假如 body 下面的布局比较复杂,可能会影响 Popup 的位置
  • 暂时没排查出来 site 本体,是哪个父元素的定位影响了 Popup 渲染(上面两个 issue 在 site 可复现,不在 site 无法复现)
  • 但可以使用以下代码,不在 site 也可以复现
import React, { useEffect } from 'react';
import { Button, Popup } from 'tdesign-react';

export default function Attach() {
  useEffect(() => {
    document.body.style.transform = 'translateY(15%)';
  }, []);

  return (
    <div style={{ height: '100vh' }}>
      <Popup trigger="click" content="Hello World">
        <Button>点击测试</Button>
      </Popup>
    </div>
  );
}

Vue 端已经采取这个做法了:

📝 更新日志

  • fix(Popup): 将容器的位置统一设为 absolute,修复部分场景下定位异常的问题

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 27, 2025

tdesign-react-demo

npm i https://pkg.pr.new/tdesign-react@3916

commit: ff9b56b

@github-actions
Copy link
Contributor

完成

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

Successfully merging this pull request may close these issues.

3 participants