question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A waypoint set on the bottom of the scrollable page fires "onEnter" on top

See original GitHub issue

I have a scrollable <div> that is set to overflow-y: scroll. This <div> is recognized correctly as the scroll ancestor, and the height is reported as the viewport’s height (which is interesting; I would expect it to match its total size).

Inside this scrollable <div>, there are a couple of child <div>s that make the scrollable content, and the <Waypoint> comes right after these <div>s (but still in the container).

I would expect that the <Waypoint> fires onEnter once I scroll to the bottom. But on the contrary, onEnter is fired immediately (at the top), and if I scroll down, onLeave is fired. onEnter is fired again once I scroll up to the top.

If I look at the debug values, I can see that the waypoints’ top and bottom values are at 100 once I am at the top, and they become negative (!) once I scroll down.

What might cause this behaviour?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
trotzigcommented, Nov 13, 2017

If you inspect the DOM, can you find the <span> that the waypoint renders? It’s likely that it’s somewhere at the top. Since you’re using floats in your css, it might be enough to wrap the waypoint in something like

<div style={{ clear: 'both' }}>
  <Waypoint />
</div>

I hope we’re able to find a solution to this!

0reactions
trotzigcommented, Nov 16, 2017

Glad you got it working! Thanks for following up with your findings and for closing the ticket. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

A waypoint set on the bottom of the scrollable page fires ...
I have a scrollable that is set to overflow-y: scroll. This is recognized correctly ... onEnter is fired again once I scroll up...
Read more >
Make waypoint fire when bottom of element scrolls up into view
What if I want a waypoint to fire as soon as an element scrolls up into view? I have one waypoint happening when...
Read more >
Viewport / Waypoint actions in Tumult Hype: Starting an ...
Tumult Hype 3.5 introduces the concept of viewport actions: You can run any action when an element has been scrolled into the visible...
Read more >
Dead Simple Infinite Scroll with Kaminari and React Waypoint
I added a Waypoint at the bottom of my page, pointed the onEnter prop to my getPosts function, and bam! Infinite scroll, just...
Read more >
Infinite Scroll React Example with TypeScript and NextJS
Many websites implement pagination via page buttons, but infinite ... scroll with little more than a Waypoint component and an onEnter ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found