tabs
tabs copied to clipboard
fix: offset四舍五入导致hiddenTabs计算逻辑错误
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
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 |
Any update on this?
如果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