Scroll jank when scrolling up

AI-generated summary

Users are experiencing scroll jank when scrolling up in Discourse. This issue occurs when the previous page loads, causing the scroll to jump around dfabulich. The problem is more noticeable with slow network speeds dfabulich.

Stephen suggests that using the timeline scroller handle mitigates the issue, as it scrolls to the absolute top of each reply. dfabulich notes that the problem only occurs when scrolling up, as Discourse uses grey filler when scrolling down, which prevents the scroll from janking.

codinghorror explains that this is a difficult problem due to variable height posts stacked on top of the viewport. littleviolette shares videos of the issue on their community site, and joffreyjaffeux asks if the issue occurs without ads.

littleviolette confirms that the issue still occurs without ads and suggests that the software should not jump back if the user scrolls up too fast. codinghorror asks if the issue occurs in safe mode, and littleviolette reports that the issue does not occur in safe mode after updating Discourse.

However, tempogain reports that the issue still occurs in safe mode on their site. codinghorror mentions a recently fixed bug that may be related to the issue and suggests checking for unusual settings or advertisements that could cause the viewport to dynamically resize.

Scroll to the bottom of a long thread and refresh the page.

Grab the scroll bar and scroll up to the top of the page. You’ll see a loading spinner while the previous posts load. (You can make this problem more obvious using a network conditioning tool, e.g. Chrome Dev Tools Network tab, Slow 3G.)

Actual: As the posts load, the scroll jumps around.

In the linked video, you can see that RBoy’s post #76 “Maybe codinghorror can confirm” is at the top of the screen; then, when the subsequent page finished loading, the scroll jumps up to lid’s post #9 “It will be interesting to see if…”

Expected: The previous page should appear without disturbing the scroll position; whatever I saw on the screen as the previous page loads should still be on the screen when it’s drawn in.

Onebox seems not to be working with my Google Drive link. Let’s see if this works: https://drive.google.com/open?id=1ny2zYNegggQ3uPlhG9t-tEB3xkUSepcE

That just looks like posts are loading as you scroll up. It’s worse when you limit network speeds because the data takes longer to traverse a slower network.

Try scrolling using the handle on the timeline scroller. It won’t jump around because more posts aren’t being loaded ahead and causing the position of the scrollbar to be recalculated. It’s a big part of why it’s there to begin with.

I agree that this is happening because the posts are loading. With a slow network, I can reproduce this just scrolling with trackpad/mouse wheel. (Would it help to post a demo video of that?)

This problem is occurring only when scrolling up because when scrolling down, Discourse draws in a bunch of grey filler; when the posts become available, they pop in right where they’re supposed to be and the scroll doesn’t jank.

It happens because pages are rendered from top to bottom, Discourse doesn’t know the height of posts before they arrive. I can see the scrollbar hopping around as you drag up, using the scroller at least mitigates against the problem by scrolling to the absolute top of each reply.

2 Likes

I think all that’s needed is grey filler at the top, just like scrolling down.

@eviltrout spent a fair amount of time optimizing up scroll, it was quite a few years ago so maybe we are due to have one more look

3 Likes

For the record, this is a very difficult problem. And scrolling down is fundamentally different because you’re not stacking things on top of the viewport. A variable height post causes no problems when added to the bottom, but consider what it does when stacked on top.

5 Likes

Our community recently has started experiencing jumpy and glitchy screen when scrolling up too:

Is this purely a software issue? Anything else we can do to optimize the user experience while scrolling up?

Does it happen without ads ?

Yes it does. I don’t see ads as a moderator and scrolling up is still glitchy.

Is it sensible to have to software not “jump back” if the users scroll up too fast? I assume the issue is caused by the user scrolling up too fast so the posts don’t get properly rendered, as explained above. I would rather have the screen freeze than jumping back after the previous posts are done loading, which confuse users.

Also curious what happens in safe-mode ? Using Safe Mode to troubleshoot issues with themes and plugins

1 Like

Does it also happen in safe mode @littleviolette ?

1 Like

I just tried to replicate the issue in both the normal and safe mode. I was not able to replicate the issue. I updated Discourse 2 days ago – not sure if that has changed any behavior. I will ask my community for further feedback. Thank you for following up!

4 Likes

We’re also getting a lot of reports about this on our site. I tried now and found it’s still happening in safe mode. Some recent reports:

2 Likes
1 Like

We just fixed a bug where sites with unusual settings (don’t retrieve size of images) had problems with images causing scroll jump as the images resized. We have removed this setting since it was a “shoot yourself in the foot” setting. Maybe check and see if you had that enabled.

The other possible culprit is advertisements.

Basically anything that causes the viewport to dynamically resize will cause huge problems.