向上滚动时出现滚动卡顿

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 个赞

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 个赞

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 个赞

我们社区最近发现,向上滚动时屏幕会出现跳动和卡顿现象:

这是否纯粹是软件问题?我们还能采取哪些措施来优化向上滚动时的用户体验?

没有广告也会发生吗?

是的,确实如此。作为版主,我仍然看不到广告,而且向上滚动时依然存在卡顿问题。

是否应该让软件在用户滚动过快时避免“跳回”?我推测该问题是由用户滚动过快导致帖子未能正确渲染引起的,正如上文所述。我宁愿让屏幕暂时冻结,也不愿在之前的帖子加载完毕后出现跳回现象,因为这会让用户感到困惑。

也好奇安全模式下会发生什么?Using Safe Mode to troubleshoot issues with themes and plugins

1 个赞

在安全模式下也会发生吗 @littleviolette

1 个赞

我刚刚在正常模式和safe模式下尝试复现该问题,但未能成功。我在两天前更新了 Discourse,不确定这是否改变了某些行为。我会向我的社区寻求更多反馈。感谢您的跟进!

4 个赞

我们网站上也有很多关于此问题的报告。我刚才尝试了一下,发现安全模式下问题依然存在。以下是一些最近的报告:

2 个赞
1 个赞

我们刚刚修复了一个 bug,该 bug 导致具有非标准设置(不获取图片尺寸)的网站在图片调整大小时出现滚动跳动问题。由于该设置属于“自毁式”选项,我们已将其移除。请检查您是否启用了该设置。

另一个可能的罪魁祸首是广告。

基本上,任何导致视口动态调整大小的因素都会引发严重问题。