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.

Bug on scrolling to top

See original GitHub issue

I have list of numbered items. Waypoint seted up like this

  <Waypoint onEnter={ props.onEnter.bind(null, props.place) } bottomOffset="70%" topOffset="10%">
    <div><Card {...props} /></div>
  </Waypoint>

...

onEnterHandler(e) {
    console.log(e.number)
}

When I scroll from top to bottom I see (in console)

1
2
3
4
5
6
7
8

But when scroll from bottom to top

11
12
6
7
8
9
10
3
4
5
1
2

PS you need to scroll really fast to reproduce bug

I will try to craft example. Is this known thing? Or I did something strange to waypoint.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
stereoboostercommented, Jul 19, 2018

As I said this is a hack, not a full featured solution. It totally works in my case (fixes the bug), but it comes with drawbacks:

  • it is guaranteed that when the user stops scrolling they will get proper state of application
  • but it is not guaranteed that intermediate events will be fired in proper order

How it works:

  1. detect direction of scrolling with the help of event listener, previous position and current position
  2. if it goes bottom - store max number of item in the list as current item. Values should increase if you scroll down.
  3. if it goes up - store min number of item in the list as current item. Values should decrease if you scroll up.

Current item is the outcome of this hack. This is exactly what you need for scrollspy. But events are still fired in the wrong order.

More general solution, which can be incorporated in the lib would require to buffer events if they are in wrong order and then fire them in proper order. To do this we will need to introduce debounce function, which will introduce some latency in event firing process. So the question if this the solution which you expect and will accept?

0reactions
sinnbeckcommented, Jul 19, 2018

Has anyone found a proper solution for this? Or is there one on the way?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows 10 : Scroll bar keeps jumping to top & file explorer
Windows 10 : Scroll bar keeps jumping to top & file explorer auto opens, bug. Its been 25 days am facing this issue,...
Read more >
How to fix Windows 10 scrolling by itself - SoftwareKeep
In our article, you can find many solutions to get rid of this annoying bug. How to fix windows 10 keep scrolling by...
Read more >
Twitter app scrolls to top with back button issue gets ...
More specifically, the glitch occurs when the user selects a sub-thread of replies within a thread on Twitter app. When pressing the Back...
Read more >
How To Fix iPhone Scrolls Back To Top By Itself (iOS 15.5)
iPhone Scrolls Back To Top Causes​​ There are a series of reasons that can lead to iPhone scroll issues including: Software bug found...
Read more >
Keeps Auto-Scrolling Up?? : r/bugs - Reddit
As soon as I get a single inch down, the pages auto-snaps back to the top. Very F'ing annoying!! It happens both in...
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