Page MenuHomePhabricator

Image browsing: MMV doesn't display picture captions from Infobox
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue

Screenshot 2026-06-22 at 4.07.10 PM.png (1,066×724 px, 587 KB)

  • click on the image (you may click on it in the carousel too):

Screenshot 2026-06-22 at 4.17.47 PM.jpg (3,274×1,734 px, 1 MB)

What happens?:

  • the description is displayed at the top
  • the picture captions are not displayed
  • at the bottom there is just a link displayed - Public domain.

What should have happened instead?:

  • Captions should be displayed (if they are present) for infobox images

The displaying behavior should be consistent with the current display for non-infobox images, e.g. https://en.wikipedia.org/wiki/Goddard_Space_Flight_Center#/media/File%3AGoddardNetwork.jpg

Screenshot 2026-06-22 at 4.37.31 PM.png (2,396×1,368 px, 1 MB)

Screenshot 2026-06-22 at 4.24.52 PM.png (3,292×1,732 px, 3 MB)

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

  • the only link to a fimg file detail page is in the license link. It may be confusing for users to find out that it's the only link to the file page.

Event Timeline

HSwan-WMF triaged this task as Medium priority.
SherryYang-WMF raised the priority of this task from Medium to High.Jun 30 2026, 3:31 PM
SherryYang-WMF set the point value for this task to 3.Jul 1 2026, 5:12 PM

The experiment had relevant logic that I suggest to try as a first step: getCaptionIfAvailable and findNearbyInfoboxCaption.

One thing worth noting here. The reason that we didn't replicate the exact behavior from our ImageBrowsing experiment is that we decided to rely on the existing (desktop) MMV data model. So the caption-fetching behavior we currently follow is the same as what desktop MMV has done for a long time, and the logic is shared (in the bootstrap code and the LightboxImage class, etc).

I would strongly prefer to not define a separate data model for the beta viewer. So if we want to pick up captions from infoboxes more comprehensively, we may also end up applying this change to the desktop MMV experience. This isn't necessarily a bad thing, but it's worth keeping in mind.

Change #1306980 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/extensions/MultimediaViewer@master] Better detection of infobox captions

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

There is a patch up for review. This patch changes the behavior of *both* desktop/legacy MMV as well as mobile/beta MMV. It attempts to detect a common pattern where an .infobox-caption element lives adjacent to an .infobox-image element, in the same table cell. It does not attempt to cover cases where multiple images (each with their own captions) exist in a single cell.

The https://en.wikipedia.org/wiki/Diego_Maradona page is a good example of what this patch changes.

Current behavior:

  • The infobox caption says "Maradona after winning the 1986 FIFA World Cup with Argentina"
  • In the MMV lightbox, the more generic file description is used ("Players of Argentina celebrating at Estadio Azteca.")

Screenshot 2026-07-01 at 3.45.19 PM.png (2,336×2,572 px, 2 MB)

Screenshot 2026-07-01 at 3.45.22 PM.png (1,440×1,585 px, 1 MB)

Patched behavior

  • The infobox caption is picked up just as it appears in the article

Screenshot 2026-07-01 at 3.49.36 PM.png (2,194×2,226 px, 3 MB)

Patched behavior on mobile MMV

  • The infobox captoin appears at the top of the viewer with HTML stripped out; the file description appears below.

Screen Shot 2026-07-01 at 15.51.37.png (1,179×2,556 px, 2 MB)

The original design spec was to have the "image title" at the top, and the image description from commons at the bottom with the same logic that we had for the previous Minerva MMV. The new MMV was meant to replicate existing functionality only.

Screenshot 2026-07-02 at 1.58.21 PM.png (1,428×1,118 px, 501 KB)

Instead of having image title in the top spot, we have description there, which is a bug that shouldn't have happened. Title is a wikidata item that is usually present for works of art like paintings for example. Part of the complication here is that it's difficult to QA this feature without pulling up the file page and viewing MMV side-by-side.

So the first fix is to stop pulling descriptions into the title field. If there's no title, it should only have the author at the top.

@egardner is there already a ticket for this? If not, I can create one.

As far as captions are concerned, I think it's clear that the captions in the articles are of a much higher quality and relevance to the reading experience of the source article. So I will propose that we use captions from articles (this is a feature enhancement compared to the original Minerva viewer), and use image descriptions from file pages as a fallback for when the caption is not available (e.g. infobox images without clear captions).

One other tweak, we had some feedback in the image browsing RfC that the captions need more space before being truncated, and I agree. So if we could change the behaviour to be 3 lines before truncation, that would be great.

Thought it'd be easier for further testing to check the current production (wmf.9) for the info displayed in the previos MMV and net MMV in response to the comment:

The original design spec was to have the "image title" at the top, and the image description from commons at the bottom with the same logic that we had for the previous Minerva MMV. The new MMV was meant to replicate existing functionality only.

Screenshot 2026-07-02 at 1.58.21 PM.png (1,428×1,118 px, 501 KB)

Instead of having image title in the top spot, we have description there, which is a bug that shouldn't have happened. Title is a wikidata item that is usually present for works of art like paintings for example. Part of the complication here is that it's difficult to QA this feature without pulling up the file page and viewing MMV side-by-side.

So the first fix is to stop pulling descriptions into the title field. If there's no title, it should only have the author at the top.

@egardner is there already a ticket for this? If not, I can create one.

Looking at the https://en.wikipedia.org/wiki/Frederick_the_Great#/media/File%3AAdolph_Menzel_-_Fl%C3%B6tenkonzert_Friedrichs_des_Gro%C3%9Fen_in_Sanssouci_-_Google_Art_Project.jpg
And: https://commons.wikimedia.org/wiki/File:Adolph_Menzel_-_Fl%C3%B6tenkonzert_Friedrichs_des_Gro%C3%9Fen_in_Sanssouci_-_Google_Art_Project.jpg

Screenshot 2026-07-02 at 3.41.55 PM.png (1,012×540 px, 226 KB)

The file on commonswiki

  • has title
  • doesn't have captions
  • has descriptions
previous Minerva MMVBeta Minerva MMV (enwiki wmf.9)
The image caption from the article is technically displayed in MMV
Screenshot 2026-07-02 at 3.23.30 PM.png (344×383 px, 208 KB)
Screenshot 2026-07-02 at 3.20.08 PM.png (1,415×875 px, 434 KB)
as <p class="truncated-text">The Flute Concert of Sanssouci by Adolph Menzel (1852, Alte Nationalgalerie, Berlin). Frederick is depicted playing the flute in his music room at Sanssouci as C. P. E. Bach accompanies him on a fortepiano by Gottfried Silbermann.</p>
- article img caption is not present
Screenshot 2026-07-02 at 3.33.56 PM.png (371×788 px, 241 KB)
- the description from commons is present
previous Desktop MMVDesktop Beta MMV (enwiki wmf.9)
The image caption from the article is present (
Screenshot 2026-07-02 at 3.29.06 PM.png (1,237×938 px, 2 MB)
Extended image details:
Screenshot 2026-07-02 at 3.29.16 PM.png (1,245×941 px, 2 MB)
-article img caption is present - the description from commons is present
Screenshot 2026-07-02 at 3.46.45 PM.png (1,229×927 px, 1 MB)

Change #1306980 merged by jenkins-bot:

[mediawiki/extensions/MultimediaViewer@master] Better detection of infobox captions

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

Checked on enwiki beta

  • the captions from infobox template are present in Beta MMV
https://en.wikipedia.beta.wmcloud.org/wiki/Carl_Linnaeus
Screenshot 2026-07-10 at 2.13.24 PM.png (2,004×1,202 px, 1010 KB)
image = Carl von Linné.jpg caption = ''Carl von Linné'', [[Alexander Roslin]], 1775.<br />Oil painting in the portrait collection at <br />[[Gripsholm Castle]]
Screenshot 2026-07-10 at 2.15.03 PM.png (2,616×1,850 px, 3 MB)

The article https://en.wikipedia.org/wiki/Diego_Maradona (@egardner example in https://phabricator.wikimedia.org/T429839#12078420 should work too.

However, captions for infobox images have quite few varieties. The following examples won't show captions in Beta MMV

https://en.wikipedia.beta.wmcloud.org/wiki/Carl_Linnaeus, the second image in the infobox: footnotes = <br />[[File:Linne CoA.jpg|center|240px]]<center>The [[coat of arms]] of Carl von Linné.
Screenshot 2026-07-10 at 2.25.20 PM.png (956×890 px, 600 KB)
Screenshot 2026-07-10 at 2.27.25 PM.png (770×1,692 px, 1013 KB)
https://en.wikipedia.beta.wmcloud.org/wiki/Gal%C3%A1pagos_sea_lion range_map_caption = Galápagos sea lion range
Screenshot 2026-07-10 at 2.38.39 PM.png (814×1,056 px, 108 KB)
Screenshot 2026-07-10 at 2.41.18 PM.png (786×1,716 px, 150 KB)
https://en.wikipedia.beta.wmcloud.org/wiki/Golden-crowned_Sparrow image_caption = Adult; males and females are similarly plumaged
Screenshot 2026-07-10 at 2.44.43 PM.png (532×1,084 px, 388 KB)
Screenshot 2026-07-10 at 2.45.21 PM.png (772×1,686 px, 742 KB)

Given the great caption variety, probably it's worth to wait for the feedback whether more cases should be solved.

Given the great caption variety, probably it's worth to wait for the feedback whether more cases should be solved.

The fix is an imperfect solution. It should improve capturing some, not all, infobox captions. This is also hard to test on beta clusters because the beta content differs from production content, e.g., infobox images lack captions in beta (e.g., https://en.wikipedia.beta.wmcloud.org/wiki/Berlin). With that, is it okay to resolve this ticket knowing this is not a perfect solution?

Slack thread: https://wikimedia.slack.com/archives/C08TB64J750/p1783965217940379
Example: https://it.wikipedia.org/wiki/Tritone_(astronomia) - the infobox image's caption text is not captured because it's not in the <figcaption> and instead placed outside the <figure> element.
cc: @SherryYang-WMF

I'm closing this ticket, putting it back in the previous sprint, and noting that the fix is an improvement (not a perfect solution for capturing all infobox captions). Please file a new task for new requests/bugs related to infobox captions.