motion icon indicating copy to clipboard operation
motion copied to clipboard

[BUG] useScroll - Can't track element position when horizontally scrolled container

Open eghernqvist opened this issue 1 year ago • 4 comments

1. Read the FAQs 👇

2. Describe the bug

When trying to track the position of an element inside a horizontally scrolled container it doesn't give the proper element value, instead it gives the progress for the container scroll progress.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

Forked directly from the sandbox provided here, which works with the same code as below sandbox, except below is horizontal instead of vertical.

https://codesandbox.io/p/sandbox/framer-motion-track-element-position-forked-xph5yn

4. Steps to reproduce

Open the Sandbox and scroll horizontally. Note that the progress-bars are filled but based on the container scroll progress, not the local target progress value.

5. Expected behavior

Elements being tracked for X-axis scroll should be possible just like Y-axis

6. Video or screenshots

N/A

7. Environment details

Tested in Chromium 122

eghernqvist avatar Mar 11 '24 18:03 eghernqvist

Would you mind providing another link to the sandbox? I can't seem to access it but would like to take a look (:

mischulz14 avatar Mar 15 '24 16:03 mischulz14

Would you mind providing another link to the sandbox? I can't seem to access it but would like to take a look (:

Aahh, accidentally left it as Private. Fixed now!

eghernqvist avatar Mar 16 '24 09:03 eghernqvist

I couldn't fix the issue so far, but I have a feeling this is an html/css issue and not a framer issue. I'll keep trying to find an alternative @eghernqvist

mischulz14 avatar Apr 01 '24 18:04 mischulz14

I couldn't fix the issue so far, but I have a feeling this is an html/css issue and not a framer issue. I'll keep trying to find an alternative @eghernqvist

Thanks a bunch for your help! Very nice of you 🥇

eghernqvist avatar Apr 04 '24 12:04 eghernqvist