-
-
Notifications
You must be signed in to change notification settings - Fork 590
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: 🐛 forceScroll error #863
fix: 🐛 forceScroll error #863
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
我可能还需要更新一下测试用例,稍等。 |
839b483
to
756e1d4
Compare
756e1d4
to
1ca519f
Compare
Codecov Report
@@ Coverage Diff @@
## master #863 +/- ##
=======================================
Coverage 99.39% 99.40%
=======================================
Files 36 36
Lines 999 1004 +5
Branches 301 304 +3
=======================================
+ Hits 993 998 +5
Misses 6 6
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@afc163 Excuse me, who can take care of this PR |
这样延迟过于明显了: Kapture.2022-09-05.at.14.43.10.mp4 |
iShot_2022-09-05_19.15.12.mp4这是原有效果,我理解始终是有延迟问题,想解决这个问题本质上需要重新设计滚动😄 |
@zombieJ @berber1016 比较好奇为啥我设置了 sticky 后延迟的问题会很明显,没设置之前几乎感觉不到。这里面是有逻辑差异吗 |
能提供一个复现案例吗,听上去不太像我这个mr引入的问题 |
fix ant-design/ant-design#37179
当动态新增
columns
时,调用forceScroll
方法,设置scrollLeft
,并不起作用,发现此时的scrollLeft
为 0,MDN文档
此时我打印了
scrollWidth
,发现scrollWidth
与预期不同,正常scrollWidth
应该为 1800(此值为上方bug链接中的案例), 此时为 358, 与offsetWidth
,猜测符合MDN中说的第一条规则,如果元素不能滚动(比如:元素没有溢出),那么scrollLeft 的值是 0。解决办法:
我能想到的就是将
scrollLeft
设置推迟到 dom 更新后执行,不知道有没有更好的办法😮💨