Content in Details tags causes gaps when you make a jump down and scroll back up

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.

This repros easily 100% of the time, you need to scroll slowly.

Happens cause cloak/uncloak sequence in posts is not accounting for spoilers somehow.

I am adding a #pr-welcome here, would be nice to fix this but it is going to be pretty tricky

@eviltrout maybe worth you having a 2 min look at this in case there is something more sinister going on with cloak/uncloak, maybe post decorators are not firing right on uncloaked posts?


It seems pretty straightforward to me.

Uncloaking a post will save its height at that time. If you’ve expanded details, the height will have changed. When you uncloak it, it uses the previously stored height, which is now incorrect.

I think to solve this the details plugin will have to remember what was expanded, and when re-rendering that post re-apply the opened state.

Otherwise it feels weird - why is discourse collapsing details just because a post scrolled out of view?