Uploading images and scrolling up jank

Created a new thread not to pollute the old one with tech talk.

Huh. That’s strange. That doesn’t fit with my observations. Image uploads worked just fine when we first got here. TubaDiva then specifically disabled images. When talking to @codinghorror about this, he described it as an unsupported modification (what is commonly referred to as a “hack”). And later on, when we discussed the issue where scrolling up will often skip posts, he said it was because of the hack that disabled images also disabled caching images. And he said that Discourse depends on that feature to handle scrolling up properly.

I really don’t mind that we can’t directly upload images. The fact that it’s slightly harder adds a bit of friction, keeping people from posting too many images. But it would be nice if scrolling up wasn’t so janky, causing posts to get skipped as the images from previous posts load in. It’d be great if the mods/admin and the tech people could discuss ways to fix that.

I’ve literally never noticed a problem scrolling up. And i do it all the time. I wonder what the issue is.

I wonder if it is browser dependent. Do you use Chrome?

I do know that, a while back, Chrome refactored scrolling a bit to try and reduce jank, and perhaps that’s playing poorly with Discourse.

On the other hand, have you scrolled up in threads that have a lot of images or videos? That’s where it becomes the most obvious. And you have to scroll up more than like 10 posts.

The reason I will do it is that I’ll get a notification about a reply to a post, then try to scroll back up to get to where I left off last time.

I mostly use my phone. I usually use chrome or edge on my laptops, but mostly I’m on the phone.

On my android phone (I don’t log into SDMB on my phone), and “Samsung Internet”, scrolling down towards the bottom of the thread, it sometimes get stuck at around 18 of whatever posts, and not go down any further. There’s an ad there and refuse to go any more. I can click on the 18/whatever box, use the scroll bar to jump around the blockage, but then that box disappears so I have to remember what the last post had written to get back up to it. The 18/whatever box shows up at the bottom at the “stuck” point, so I’m guessing Discourse thinks it’s at the bottom and doesn’t need to go any further downward.

Scrolling up (towards the top of the page), I sometimes get “jumps”, either down or up a couple of posts (not sure which), at the ads. This I understand to be a known issue because of reasons. (I don’t remember where I read this.)

A different Discourse website I go to doesn’t have these scrolling problems, but it doesn’t have the interwoven ads (if that’s the term?).

I hope this is the correct thread to report this.

Ah. I haven’t really encountered it much on my phone, either, to tell the truth. I think they way phone browsers implement scrolling is different.

Also it may be beneficial to make a bit of clarification since phones have entered the conversation. By scrolling up, I mean moving to the top of the page. This is different from swiping up, which moves to the bottom of the page.

Yes, this is the issue I am describing. I was told it was due to image caching being disabled on our forum. This was said to be a hack that broke a bit of Discourse functionality. puzzlegal’s post reminded me of this issue. Hence why I’m asking that image caching be reenabled.

This, however, is a problem being described in a different thread. Your insight about it having to do with the ads may be relevant, so I’d post about that in the other thread.

I wasn’t sure that thread was still active. It looked like it crashed and burned, to be honest. I’ll repost over there.

Do you mean moving to the top of the page, or moving the the direction of the top of the page? I would call both of those scrolling up, except that if I want to get to the top of a page on my phone, in discourse, I usually use the “jump to” facility.

(Also, I didn’t “bring phones into the discussion”. You neglected to clarify that the issue you describe manifests on your non-phone hardware. Most of the world mostly accesses the internet on phones, I believe. Any generic discussion of “what does it look like” ought to presume that phones are part of the conversation.)

Sorry. Yes, that word “to” should have been “toward.”

I agree that it kinda died, but it’s recent enough that I think it was better to resurrect it than to make a new thread.

There are technically no images here but you can hotlink remote images.

The risk factor is images without dimensions, which push the layout around as they load. The browser is like “hey, look, time to load an image” and then it’s like “hey, this is a SUPER TALL image” which has to be inferred at load time since the image is not local, but remote.

Here’s a hotlinked image from imgur that I posted a while back

I posted :point_up_2: by putting a link to the image on a line by itself

https://i.imgur.com/8sbvSo7.png

Normally Discourse would pull that image down and make a copy of it so that it isn’t lost and its disappearance doesn’t ruin the discussion years later. Why does Discourse do this? Well, imagine a “hey, look at this interesting picture of a boat” topic with 50 replies, where the image of the boat in that first post is long gone because the site hosting the image disappeared from the internet in 2015. That’s kind of a busted discussion, hence the desire to copy the image and host it locally so the discussion is still useful and interesting, a decade later.

Let’s see what that image looks like in the post.

Yes, that ends up as this:

<a href="https://i.imgur.com/8sbvSo7.png" target="_blank" rel="noopener nofollow ugc" class="onebox">
    <img src="https://i.imgur.com/8sbvSo7.png" width="" height="" loading="lazy">
</a>

Note the lack of width and height, and the lazy loading. So this will definitely bust scrolling and push the layout around. Unfortunately, this combination of settings (no local images) is rather rare in Discourse so we haven’t tried to optimize it.

I understand the problem. We discussed it beforem My question is whether or not we can enable image caching. Would it indeed cost (a lot) more money to do that?

Ideally, Discourse would cache the image’s dimensions and have viewport-scaled placeholders (e.g. by having the scales dimensions in the img tag). Or, better yet, preload images at least partt way before the mpost itself needs to mbe displayed.

We are looking at this and it might be a setting that was exposed and staff turned off. We don’t think this setting (to skip image dimensions) should be user-facing so we’re going to remove the setting.

Thanks for bringing it up – definitely highlighted a deeper issue!

OK! We rolled out a fix for the bug and are rebaking all posts containing images. Thanks for reporting this… we do have the image dimensions, but there was an errant site setting that let admins disable image dimensions… we have removed this site setting since it’s a “shoot yourself in the foot” setting.

This rebake may take a while as it is 8,658,086 posts (ones with images), and it will happen in the background.

I’ll post an image here again, and let’s see if it gets dimensions set.

Good news! View source via F12 and you’ll see

<img src="https://i.imgur.com/8sbvSo7.png" width="690" height="494" loading="lazy">

Unfortunately, I’m in a lousy position to test right now as I’ve just upgraded my internet. Having the images load faster will also make it work better, even without this fix.

So I very much ask others who have experienced this to also check over time if scrolling up jank gets better.

Thanks, @codinghorror. This is exactly what I’ve been hoping for since the first time I reported this issue—cache the image dimensions.

Most images without dimensions are now rebaked with dimensions. We’re still dealing with stragglers. So you should see a whole lot less of this right now – try to pay attention if you’re in a topic with a lot of pictures in it and see what happens.

But thanks all again for bringing this up and sticking with it because we drilled down to a very solid fundamental bug that fixes this problem, forever, across many instances! :pray:

Many old posts (including some of mine) link to remote images that are already long-gone. What becomes of those now?

If you really want to recover the lost remote image, try the wayback machine and pray. Not a lot of good options for images that go missing on defunct websites, sadly.

We do believe strongly in mirroring images in discussions for the reasons I stated above!