release: v3.26.77 悬停滚动兜底(祖先 scroll + wheel/touchmove)
This commit is contained in:
1 parent
2f8d2fb134
commit
a08bb71ece
6 files changed
+24
-6
No files matched your search
@@ -1046,14 +1046,26 @@ function GSetGroup (props) {
|
||||
setHot(false)
|
||||
}
|
||||
document.addEventListener('pointermove', onMove, true)
|
||||
document.addEventListener('scroll', off, true)
|
||||
document.addEventListener('mouseleave', off)
|
||||
window.addEventListener('blur', off)
|
||||
/* 滚动兜底:WebKit 的 scroll 事件**不冒泡、且 document 上的捕获监听收不到**
|
||||
* (v3.26.76 用 document 捕获仍失效,用户实测滑动后按钮还在)。
|
||||
* ⇒ 直接给「当前行到根的所有祖先」都挂 scroll(含设置弹窗内部滚动容器),
|
||||
* 并补 wheel/touchmove(惯性滚动时这两个也一定触发)。 */
|
||||
const scrollers = []
|
||||
let p0 = rowRef.current
|
||||
while (p0) { try { p0.addEventListener('scroll', off, true); scrollers.push(p0) } catch (e) { /* ignore */ } p0 = p0.parentElement }
|
||||
window.addEventListener('scroll', off, true)
|
||||
document.addEventListener('wheel', off, true)
|
||||
document.addEventListener('touchmove', off, true)
|
||||
return () => {
|
||||
document.removeEventListener('pointermove', onMove, true)
|
||||
document.removeEventListener('scroll', off, true)
|
||||
document.removeEventListener('mouseleave', off)
|
||||
window.removeEventListener('blur', off)
|
||||
for (const el0 of scrollers) { try { el0.removeEventListener('scroll', off, true) } catch (e) { /* ignore */ } }
|
||||
window.removeEventListener('scroll', off, true)
|
||||
document.removeEventListener('wheel', off, true)
|
||||
document.removeEventListener('touchmove', off, true)
|
||||
}
|
||||
}, [hot])
|
||||
const kids = props.children
|
||||
|
||||
Reference in new issue
Block a user