内容在 Details 标签中会导致跳转后向上滚动时出现空白

To reproduce on meta:

  1. Go to this post: Events Plugin 📆
  2. Open the " Detailed log from Chome console" section in that post.
  3. Click on the bottom date of timeline to go to bottom of topic
  4. Scroll back to up to the post
  5. There’ll be a giant blank space that’s the length of the post as if the spoiler were open.
4 个赞

这个问题可以 100% 稳定复现,需要缓慢滚动页面。

出现该问题的原因是帖子中的隐藏/显示序列似乎没有正确处理 spoiler。

我在这里添加了一个 pr-welcome 标签。修复这个问题会很棘手,但希望能解决。

@eviltrout 或许值得花两分钟看一下,以防隐藏/显示机制存在更严重的问题,比如帖子装饰器在显示帖子时没有正确触发?

4 个赞

对我来说这看起来相当直接。

取消隐藏帖子时会保存其当前的高度。如果你已经展开了详情,高度就会发生变化。当你取消隐藏时,它会使用之前存储的高度,而那个高度现在已经不正确了。

我认为要解决这个问题,详情插件必须记住哪些内容被展开了,并在重新渲染该帖子时重新应用展开状态。

否则感觉很奇怪——为什么 Discourse 仅仅因为帖子滚出视图范围就折叠详情内容呢?

4 个赞