virtual-list
                                
                                 virtual-list copied to clipboard
                                
                                    virtual-list copied to clipboard
                            
                            
                            
                        fix: wheel handler set passive false
List.js:248 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
when use preventDefault in wheel event handler, should set passive false
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/react-component/virtual-list/h2dfum9mm
✅ Preview: https://virtual-list-git-patch-1.react-component.vercel.app
Codecov Report
Merging #97 (d106480) into master (fe039bf) will not change coverage. The diff coverage is
100.00%.
@@            Coverage Diff            @@
##            master       #97   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        15           
  Lines          470       470           
  Branches        89        89           
=========================================
  Hits           470       470           
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/List.tsx | 100.00% <100.00%> (ø) | 
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update fe039bf...d106480. Read the comment docs.
passive 默认就是 false。
componentRef.current.addEventListener('wheel', onRawWheel, {
  passive: true,
});
我看内部使用了 event.preventDefault() ,设置为 true 就使它失效了。
Emmm...不知道有没有其他方案。
passive默认就是false。componentRef.current.addEventListener('wheel', onRawWheel, { passive: true, });我看内部使用了
event.preventDefault(),设置为true就使它失效了。Emmm...不知道有没有其他方案。
passive: true 是默认值吧,如果内部想要调用event.preventDefault(), 就需要使用false, 否则一堆警告。
passive默认就是false。componentRef.current.addEventListener('wheel', onRawWheel, { passive: true, });我看内部使用了
event.preventDefault(),设置为true就使它失效了。 Emmm...不知道有没有其他方案。passive: true 是默认值吧,如果内部想要调用
event.preventDefault(), 就需要使用false, 否则一堆警告。
要看是什么事件,touchstart 和 touchmove 默认的 passive 是 true。
这警告不是由于 event.preventDefault() 呀。
相当于是 Chrome 的一个建议,非被动的(non-passive)的事件监听可能会阻塞页面响应。