Page MenuHomePhabricator

Regression: Images do not show when printing article on mobile
Closed, ResolvedPublic2 Estimated Story PointsBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • On Google Chrome visit any article with lots of images
  • Click print

What happens?:
Lazy loaded images do not appear in the article

What should have happened instead?:
Lazy images should appear.

Developer notes

Given https://bugs.chromium.org/p/chromium/issues/detail?id=875403#c40 was fixed this, onbeforeprint event blocks the print action. It can thus be fixed with 4 lines of code:

var lazyImageLoader = mw.mobileFrontend.require('mobile.startup').lazyImages.lazyImageLoader;
window.onbeforeprint = function () 
  lazyImageLoader.loadImages( lazyImageLoader.queryPlaceholders( document.getElementById( 'mw-content-text' ) ) );
}

Event Timeline

ovasileva renamed this task from Images do not show when printing article on mobile to Regression: Images do not show when printing article on mobile.Feb 28 2022, 10:01 AM
ovasileva triaged this task as Low priority.
Jdlrobson raised the priority of this task from Low to Medium.Mar 3 2022, 9:22 PM

I'm surprised this is only a Medium, but then again how many people indeed print from mobile? Do you happen to have numbers on that? (Just curious!) @LGoto

bwang removed bwang as the assignee of this task.Apr 25 2022, 9:33 PM
bwang added a subscriber: bwang.

@bwang did you forget to submit the patch?

Change 785920 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/extensions/MobileFrontend@master] Use beforeprint event to load all images in print mode

https://gerrit.wikimedia.org/r/785920

Change 785920 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Use beforeprint event to load all images in print mode

https://gerrit.wikimedia.org/r/785920

Edtadros added a subscriber: Edtadros.

Test Result - Beta

Status: ❌ Fail
Environment: beta
OS: macOS Monterey
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

On Google Chrome visit any article with lots of images
Click print
What happens?:
❌ AC1: Lazy images should appear.

Starting with Page 11, a partial image

Screen Shot 2022-05-03 at 7.16.38 PM.png (956×972 px, 153 KB)

Page 12 an on, only image placeholders exist.

Screen Shot 2022-05-03 at 7.16.50 PM.png (1×2 px, 265 KB)

This is the pdf

@Jdlrobson, most likely unrelated to the lazy loaded images, in some areas, the text at the bottom of a page will be partially displayed, with the bottom half of the text displayed on the next page.

Screen Shot 2022-05-03 at 7.18.25 PM.png (1×2 px, 193 KB)

@Edtadros looks like you are not testing the mobile site on a mobile device.
The first page should look like:

Screen Shot 2022-05-04 at 2.26.24 PM.png (1×1 px, 170 KB)

Seems to work for me.

@Jdlrobson So I tried the mobile site and it works. But Chrome has a setting that allows you to preload webpages on wifi (Settings->Bandwidth). If I set it to never, even if I see the image in the browser, it doesn't appear in the pdf.

. If this is acceptable I will move this to Ready for Signoff.

For the purpose of this ticket, I think that's fine. Does sound like another bug, but probably one that's low priority to fix.

ovasileva added a subscriber: ovasileva.

@Jdlrobson So I tried the mobile site and it works. But Chrome has a setting that allows you to preload webpages on wifi (Settings->Bandwidth). If I set it to never, even if I see the image in the browser, it doesn't appear in the pdf.

. If this is acceptable I will move this to Ready for Signoff.

+1, this seems fine for the purpose of this task. Resolving.