Page MenuHomePhabricator

MMV doesn't recognize captions of the new <figure> thumbnails
Closed, ResolvedPublicBUG REPORT

Description

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

  • wgParserEnableLegacyMediaDOM=false
  • Transclude [[File:Test.jpg|thumb|An example]] on a page
  • Click to open the image in MMV

What happens?:
The title used is "Test"

What should have happened instead?:
The title used should have been: An example
It seems that MMVs findCaption logic does not yet recognize the new style of captions.

Software version (skip for WMF-hosted wikis like Wikipedia):

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

Event Timeline

@TheDJ I wasn't able to reproduce this, can you clarify?

Screen Shot 2022-10-24 at 3.32.45 PM.png (2×2 px, 2 MB)

Screen Shot 2022-10-24 at 3.32.57 PM.png (2×2 px, 3 MB)

Ah it's actually more specific than i had figured.

		$potentialCaptions = $thumbContainer.find( '.thumbcaption, figcaption' );
		if ( $potentialCaptions.length < 2 ) {
			$thumbCaption = $potentialCaptions.eq( 0 );
		} else {
			// Template:Multiple_image or some such; try to find closest caption to the image
			// eslint-disable-next-line no-jquery/no-sizzle
			$thumbCaption = $link.closest( ':has(> .thumbcaption)', $thumbContainer )
				.find( '> .thumbcaption' );
		}

It's this condition for multiple_image that fails on this specific fragment of image encapsulated within the caption of another image. Apparently that was also handling nested captions by accident.

[[File:Test.jpg|thumb|An example [[File:Example.svg|100px|right|frameless|Just another example]]]]

Change 849714 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/extensions/MultimediaViewer@master] Use Parsoid's regularity to find caption

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

Change 849714 merged by jenkins-bot:

[mediawiki/extensions/MultimediaViewer@master] Use Parsoid's regularity to find caption

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