Won't fix Go to unread messages affected by URL unfurling

Affected version
2.1

Overscan

Active member
A few of my users have noted an issue with the "go to unread messages" function. Specifically, the button takes you to the correct message momentarily, then the page scrolls (up or down) and you are no longer at the first unread message.

I've figured out this is caused by enabling URL unfurling. Specifically, you jump to what is the correct page position on the page initially, but when URLs are unfurled above or below the current post, the page size increases, which means your page position is no longer at the correct point of the first unread message.

I can't see a fix for this except

1) DIsable unfurling
2) Recode XenForo to wait on going to the first unread message until the page is entirely rendered, including unfurling, so its size won't change.

However, you guys are smarter than me, so maybe you can see a fix for this. I know that Google is starting to penalize sites which resizes pages after load ("Cumulative Layout Shift") so if might be worth addressing?
 
Last edited:

Mike

XenForo developer
Staff member
I think we actually take steps to mitigate this in the common case. There are some page loads that might trigger it, but in most cases, we actually load the unfurl from the server so the content is all in the DOM on the first load. The only thing that is loaded after the fact is the thumbnail image (and favicon, though given how small that is it shouldn't be an issue). The thumbnail may trigger it, though that's roughly the same case as an embedded image in a post that doesn't have known dimensions.

The case where this might happen more dramatically is when we haven't crawled an unfurl yet as then we just serve a "Loading" placeholder. However, this mostly applies to the first time a URL is seen and at most once every 30 days after that.

Note that we do also already have some code in place to attempt to rescroll to the correct location when the page has finished loading (which includes all <img> tags in the page). However, there are limitations here as we don't want to scroll the user back if they've chosen to scroll elsewhere. Once that has happened, it's mostly down to the browser to prevent height changes above the viewport from scrolling the page (which I know Chrome did make changes for in the past, for example).

So overall, I think I probably need to call this "won't fix" though note that we've already done a number of things to try to mitigate this.
 

Overscan

Active member
I think we actually take steps to mitigate this in the common case. There are some page loads that might trigger it, but in most cases, we actually load the unfurl from the server so the content is all in the DOM on the first load. The only thing that is loaded after the fact is the thumbnail image (and favicon, though given how small that is it shouldn't be an issue). The thumbnail may trigger it, though that's roughly the same case as an embedded image in a post that doesn't have known dimensions.

The case where this might happen more dramatically is when we haven't crawled an unfurl yet as then we just serve a "Loading" placeholder. However, this mostly applies to the first time a URL is seen and at most once every 30 days after that.

Note that we do also already have some code in place to attempt to rescroll to the correct location when the page has finished loading (which includes all <img> tags in the page). However, there are limitations here as we don't want to scroll the user back if they've chosen to scroll elsewhere. Once that has happened, it's mostly down to the browser to prevent height changes above the viewport from scrolling the page (which I know Chrome did make changes for in the past, for example).

So overall, I think I probably need to call this "won't fix" though note that we've already done a number of things to try to mitigate this.
Thanks for the reply, Mike. It only seems to affect topics with a large number of unfurled URLs present and it’s not a problem for 99% of users - as you typically end up within a few posts of the correct location.

I typically scroll back to catch up with recent posts in the topic anyway.
 
Top