Skip to content
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

fix: offset四舍五入导致hiddenTabs计算逻辑错误 #667

Closed

Conversation

hyx0217
Copy link

@hyx0217 hyx0217 commented Jul 7, 2023

2023-07-07.14.19.32.mov

antd复现的Bug,相关issue: ant-design/ant-design#39079

@vercel
Copy link

vercel bot commented Jul 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tabs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 26, 2023 8:33am

const { offsetWidth = 0, offsetHeight = 0 } = refObj.current || {};
return [offsetWidth, offsetHeight];
const { width = 0, height = 0 } = refObj?.current?.getBoundingClientRect() || {};
return [width, height];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chriskfwoo
Copy link

Any update on this?

@tonny008
Copy link

如果tab内部没有scale,使用 getBoundingClientRect本身就是个错
https://developer.mozilla.org/en-US/docs/Web/API/CSS_Object_Model/Determining_the_dimensions_of_elements

出现这个的原因是这里

if (offset[position] + offset[charUnit] > transformSize + visibleTabContentValue) {

floating numer的运算,导致本来想等的变大于了, 毕竟js

0.1+0.2>0.3  =>true

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.

4 participants