Fix issue where grid highlighted rows are incorrect when page is scrolled
This commit is contained in:
parent
08a48a9ff9
commit
7566ecfac8
|
@ -23,14 +23,24 @@
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const updateBounds = () => {
|
||||||
|
bounds.set(body.getBoundingClientRect())
|
||||||
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
// Observe and record the height of the body
|
// Observe and record the height of the body
|
||||||
const observer = new ResizeObserver(() => {
|
const resizeObserver = new ResizeObserver(updateBounds)
|
||||||
bounds.set(body.getBoundingClientRect())
|
resizeObserver.observe(body)
|
||||||
})
|
|
||||||
observer.observe(body)
|
// Capture any wheel events on the page to ensure our scroll offset is
|
||||||
|
// correct. We don't care about touch events as we only need this for
|
||||||
|
// hovering over rows with a mouse.
|
||||||
|
window.addEventListener("wheel", updateBounds, true)
|
||||||
|
|
||||||
|
// Clean up listeners
|
||||||
return () => {
|
return () => {
|
||||||
observer.disconnect()
|
resizeObserver.disconnect()
|
||||||
|
window.removeEventListener("wheel", updateBounds, true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue