tabs icon indicating copy to clipboard operation
tabs copied to clipboard

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

Open hyx0217 opened this issue 1 year ago • 3 comments

https://github.com/react-component/tabs/assets/45928314/42743698-e903-47bd-9edd-2d5d369fb331

antd复现的Bug,相关issue: https://github.com/ant-design/ant-design/issues/39079

hyx0217 avatar Jul 07 '23 06:07 hyx0217

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

vercel[bot] avatar Jul 07 '23 06:07 vercel[bot]

Any update on this?

chriskfwoo avatar Jan 16 '24 19:01 chriskfwoo

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

出现这个的原因是这里 https://github.com/react-component/tabs/blob/2e015f6d2db40b6b5bc342ce67f3a273d814992a/src/hooks/useVisibleRange.ts#L41

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

0.1+0.2>0.3  =>true

tonny008 avatar Jul 12 '24 07:07 tonny008