motion icon indicating copy to clipboard operation
motion copied to clipboard

[BUG] useElementScroll function is not working.

Open jipi-dev opened this issue 6 years ago • 4 comments

1. Read the FAQs 👇 ✔︎

2. Describe the bug useElementScroll function is not working as expected in version v1.11.1 If I try tu use useElementScroll method on a section of my web, the MotionValue result is not changing.

Is working fine with useViewportScroll, i think that useElementScroll is similar but with a ref element, i'm ok? or I misunderstand the function?

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

CodeSandbox (is the useViewporScroll example, converted to useElementScroll example) https://codesandbox.io/s/scroll-r31k1?file=/src/Example.tsx

4. Steps to reproduce

Steps to reproduce the behavior:

  1. Go to CodeSandbox
  2. Open devtool to wath the change on the doms elements motion.div
  3. Scroll down to end of example
  4. See that the styles of motion.div's are not changing

5. Expected behavior Update values when the provided element scrolls:

Maybe I am misinterpreting how it is used, if so please excuse the "bug" but I need to know how to implement it correctly.

jipi-dev avatar Jun 16 '20 20:06 jipi-dev

Me too

ianatlion avatar Jun 22 '20 00:06 ianatlion

Having the same issue, but it looks like you need to have an element with overflow: Example

slangdog avatar Jun 23 '20 13:06 slangdog

useElementScroll expects a scrollable element. I'll clarify in the docs.

mattgperry avatar Jul 17 '20 13:07 mattgperry

Does it work when only overflow-x set to scroll? Overflow-y is hidden

yareyareslav avatar May 08 '24 12:05 yareyareslav