Page MenuHomePhabricator

Media Viewer: Possible to bypass the Media Viewer and go to file description page if page is not fully loaded
Closed, ResolvedPublic

Description

If a page has a lot of content on it, you will sometimes be taken to the file description page for an image instead of the Media Viewer.

Workflow to reproduce:

  1. Go to https://commons.wikimedia.org/wiki/User:Fabrice_Florin_(WMF)/gallery
  2. Scroll down and click on the first image while the page is still loading

You will be taken to the description page for the image instead of the Media Viewer.

I would guess this problem is being caused by the code for the Media Viewer only being loaded after the thumbnails for the images have been loaded, because this problem tends to not be reproducible if you go back to the page after the thumbnails are cached, even if you're really quick about clicking a picture.


Version: unspecified
Severity: minor

Details

Reference
bz62540

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:00 AM
bzimport added a project: MediaViewer.
bzimport set Reference to bz62540.
bzimport added a subscriber: Unknown Object (MLST).

I don't think we can do anything currently to make the loading any faster, but Gilles may beg to differ.

FWIW I asked Krinkle about loading MMV top-side and he said it wasn't necessary, so that's not our path forward.

I've set the priorities on this based on Mark's comments. Anyone involved in the development of Media Viewer should feel free to revise as necessary.

MMV is just a 16K bootstrap file now, so top-loading it does not sound that bad to me. I don't see other options apart from wontfixing this - until it is not loaded, we cannot interfere in any way with what an image click does.

(In reply to Tisza Gergő from comment #3)

MMV is just a 16K bootstrap file now, so top-loading it does not sound that
bad to me. I don't see other options apart from wontfixing this - until it
is not loaded, we cannot interfere in any way with what an image click does.

The bug itself is relatively minor, but on the other hand the inconsistency of user experience this causes is relatively severe. I was left wondering whether Media Viewer was broken, whether I'd forgotten to enable it on my account (I had to check that), and then I cleared my cache and tried again which actually caused the problem to happen again.

CCing Krinkle to get his input on fixing this.

Actually, I may have been thinking about this wrong - we *do* change visual things above the fold when a hash fragment is detected, so maybe we should actually be top-loading.

We will talk about this tomorrow at the planning meeting, I think.

There is a foolproof technical solution for this: an inline onclick handler defined in the HTML that "replays" the click when the DOM is loaded.

Shoving all the mmv bootstrap code in the head is inefficient and it wouldn't solve the problem: on a cold cache it still takes time to download the JS file, and you might see the DOM appear on the page before the JS is actually loade & executed. So there would still be a chance to trigger this situation. The window would be smaller, but it could still happen.

And by replay I mean that it would of course swallow the original click that happens before the DOM is ready and replay it on DOM readiness. I didn't mean having the event twice for a single click.