iOS:在主题列表中,“返回”会跳转到错误的位置

The ‘back’ function in Safari/iOS (iPhone 8, latest iOS version) is unreliable; when going from the topic list to a topic, it will often not take you back to the correct position in the topic list. On my own forum this happens pretty much always. On Meta, it sometimes works for me, but more often it doesn’t. This happens both when clicking the ‘back’ button and when swiping to the right.

4 个赞

Out of curiosity does it work in safe mode ?

3 个赞

Sorry I forgot to mention that: I tested safe mode both on my own forum and here on Meta with the same result.

1 个赞

In the iOS hub app or in native mobile safari? I can’t repro any problem using the back button or back swipe from the topic list here on meta.

Do you have specific repro steps?

Oh wait, I can repro for back swipe, but not back button. Back swipe doesn’t seem to remember the actual scroll position in the topic list, but back button always does.

4 个赞

In native mobile safari. At first I had a hunch it was related to the topic list refreshing, but that doesn’t seem to be the case. It happens 100% of the time for me on Meta now.

Repro steps:

  • Log in to Meta
  • Reload the Meta homepage (this step doesn’t seem necessary but I wanted to rule out the topic list refresh issue)
  • Scroll one page down
  • Select a topic
  • Swipe right or click back

I also tried the following, all with the same result:

  • Disabled the Crystal ad blocker in content blocking.
  • Opened Meta in a private tab without logging in.
  • Tested on an iPhone SE.
  • Tested in Chrome on a Galaxy S6
5 个赞

That does seem to repro for me @eviltrout … perhaps we regressed here? @j.jaffeux?

6 个赞

这应该能解决问题:

详细信息在提交信息中,下周合并前会等待 Robin 的批准。感谢详细的报告 :+1:

11 个赞

已合并,请告诉我进展如何。

6 个赞

此主题已在最后回复后 3 天自动关闭,不再接受新回复。

在与 @bartv 讨论后,我进行了进一步调查,发现确实存在回归问题。

我认为问题源于:

基本上,在这种情况下,scrollOnLoad 为未定义:
https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/components/topic-list.js.es6#L71

我建议采用以下修复方案:

@markvanlan 能否请您下周帮忙审查?

10 个赞

@bartv 我刚合并了第二个修复,等你有空时请告诉我效果如何。

顺便一提,我在想我们是否还能进一步优化这个逻辑?目前的做法是在每次页面滚动时记录一个帖子的位置,但在移动设备上,这可能导致当你返回时,你点击的帖子不在视口内,即使它离得不远。

5 个赞

我刚刚在 Meta 上测试了一下,但对我来说不起作用——当我从某个话题点击“返回”时,会回到话题列表的顶部。

另外,我也赞同回到话题列表中的确切位置。

对我来说是有效的,有空时请录个视频。

2 个赞

我已经把它添加到我的帖子中了。希望这能帮到你,如果需要我包含其他内容,请告诉我。

1 个赞

视频显示的情况符合预期,因为你并没有执行“页面滚动”操作,即没有加载更多主题,因此未更新最后浏览主题的位置。

这正是我的侧边注释提议改进的地方。

3 个赞

啊,我可以确认,当我向下滚动足够远以强制加载新主题时,它确实有效。我没想到会有这种限制——作为用户,这有点令人困惑/不一致。

1 个赞

是的,我也不太喜欢这一点,所以我提议改进它。但据我所知,这不像我修复的其他问题那样是回归。

4 个赞

该提交确实引入了另一个回归问题,我认为这应该能解决它:

并实现我们之前讨论的行为!

6 个赞