Page MenuHomePhabricator

Displayed image in upload form depends on deprecated CSS classes
Closed, ResolvedPublicBUG REPORT

Assigned To
Authored By
SnorlaxMonster
Feb 15 2025, 7:08 AM
Referenced Files
F58401607: image.png
Feb 15 2025, 7:08 AM
F58401665: image.png
Feb 15 2025, 7:08 AM
F58401604: image.png
Feb 15 2025, 7:08 AM

Description

Steps to replicate the issue (include links if applicable):

In MediaWiki 1.40 or later, go to Special:Upload and select an image to upload. Look at the preview of the selected image.

What happens?:

When uploading an image using Special:Upload, after choosing the file to upload, a preview of the image appears on the upload form. This image is intended to float on the right side of the screen, in a frame like would be used when displayed in an article.

However, instead the image is just placed on the left at the top of the "Source file" form.

image.png (1,745×412 px, 45 KB)

Screenshot from Bulbagarden Archives (Bulbapedia)

image.png (1,709×389 px, 40 KB)

Screenshot from Zelda Wiki

What should have happened instead?:
This image should float on the right side of the screen, in a frame like would be used when displayed in an article.

image.png (1,561×308 px, 37 KB)

Screenshot from English Wikipedia

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Observed in 1.41.4 (Zelda Wiki) and 1.43.0 (Bulbagarden Archives), but it should occur for all versions from 1.40 onward, based on my understanding of why this occurs that is explained below.

Other information (browser name/version, screenshots, etc.):

This appears to be because this display depends on the deprecated CSS classes thumb and tright. You can enable these deprecated classes by setting $wgUseLegacyMediaStyles to true, but that variable is set to false by default. Since MediaWiki 1.40, due to $wgParserEnableLegacyMediaDOM being set to false by default, this means those deprecated CSS classes will not work unless one of those two settings is changed.

As a result, this means that without specifically enabling legacy behaviour, from MediaWiki 1.40 onward, the default upload form will display incorrectly.

Event Timeline

Change #1196754 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] upload: Add styles for image preview on Special:Upload

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

Change #1197019 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] specials: Replace img tag with Linker::makeImageLink on Special:Upload

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

Change #1196754 merged by jenkins-bot:

[mediawiki/core@master] resources: Update thumbnail html for file preview on Special:Upload

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

Change #1197019 merged by jenkins-bot:

[mediawiki/core@master] specials: Update thumbnail html for file warnings on Special:Upload

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