-
Notifications
You must be signed in to change notification settings - Fork 167
fix: Add patch fix for firefox mouse wheel #49
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
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/react-component/virtual-list/kaafgvlat |
Codecov Report
@@ Coverage Diff @@
## master #49 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 13 14 +1
Lines 345 357 +12
Branches 60 63 +3
=========================================
+ Hits 345 357 +12
Continue to review full report at Codecov.
|
onWheelDelta(offsetRef.current); | ||
// Patch a multiple for Firefox to fix wheel number too small | ||
// ref: https://github.com/ant-design/ant-design/issues/26372#issuecomment-679460266 | ||
const patchMultiple = isMouseScrollRef.current ? 10 : 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个数字会不会跟着操作系统和硬件发生变化?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,2 @@ | |||
const isFF = /Firefox/i.test(navigator.userAgent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to fix for serveer-side-rendering
const isFF = typeof navigator !== 'undefined' && /Firefox/i.test(navigator.userAgent);
Current nodejs error:
ReferenceError: navigator is not defined
vpc-admin: [dev] at Object.<anonymous> (/Users/nodkz/www/ps/vpc/apps/admin/node_modules/rc-virtual-list/lib/utils/isFirefox.js:7:28)
@zombieJ you break server-side-rendering on nodejs |
Hotfix #50 |
resolve ant-design/ant-design#26372
Firefox 的鼠标滚动触发的 wheel 事件
deltaY
会比触摸板小很多。导致滚动看起来只有一小段距离,加一个 patch 来监听 FF 事件,如果发现 wheel 和 滚轮 事件数值相同(说明用的是鼠标),则添加一个倍数来滚动。自己这边测了一下,FF 鼠标滚动和滚屏大概差 8 ~ 11 倍之间