Page MenuHomePhabricator

Multilingual Captions: Content isn't clear:both'ed on Files with no captions yet, because it's still wrapped in a mw:mediainfoView tags
Closed, ResolvedPublic

Description

On this and many similar pages with a category cleanup template, the template's background goes behind much of the captions interface: https://commons.wikimedia.org/wiki/File:1st_St_from_Oak_St,_Port_Angeles,_1914_(CURTIS_71).jpeg

category template background overlap.png (962×2 px, 113 KB)

Event Timeline

Ramsey-WMF subscribed.

I'm not sure if this is our fix to make, but probably should investigate.

Jdforrester-WMF renamed this task from Multilingual Captions: background of maintenance template extends to captions interface to Multilingual Captions: Content isn't clear:both'ed on Files with no captions yet, because it's still wrapped in a mw:mediainfoView tags.Jan 17 2019, 7:39 PM
Jdforrester-WMF subscribed.

Yeah, this should have been fixed by me last week, but for some reason the HTML structure of with-captions and without-captions differs so the selector didn't cover both. I'll fix the DOM.

Change 485084 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/WikibaseMediaInfo@master] Don't add mw:mediainfoView on File pages with no captions either

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

Change 485084 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Don't add mw:mediainfoView on File pages with no captions either

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

This will go live on 2019-02-05 on TestCommons and 2019-02-06 on Commons.

Change 486344 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/WikibaseMediaInfo@wmf/1.33.0-wmf.14] Don't add mw:mediainfoView on File pages with no captions either

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

Change 486344 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@wmf/1.33.0-wmf.14] Don't add mw:mediainfoView on File pages with no captions either

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

Mentioned in SAL (#wikimedia-operations) [2019-01-24T19:32:06Z] <jforrester@deploy1001> Synchronized php-1.33.0-wmf.14/extensions/WikibaseMediaInfo/src/WikibaseMediaInfoHooks.php: SWAT T213885 Don't add mw:mediainfoView on File pages with no captions either (duration: 00m 51s)

Update: I brought this code forward but it didn't work, and I'm trying to work out why.

I still can't work out quite why the output from the PHP is not correct in these cases, even following a purge or a real edit. In the mean time you can use the following code in your user script code to fix it for you, but this isn't a scalable solution, obviously:

var entityView = $( document ).find( '.wbmi-entityview' );
if ( entityView[ 0 ].parentNode.outerHTML.match( 'mw:mediainfoview' ).length ) {
	$( '.mw-slot-header' ).after( entityView.clone( true ) );
	entityView[ 0 ].parentNode.remove();
}

@Jdforrester-WMF I don't really know this stuff, but could it be a problem that you are calling getMediaInfoViewRegex before you've defined it?

@Jdforrester-WMF I don't really know this stuff, but could it be a problem that you are calling getMediaInfoViewRegex before you've defined it?

Sadly, no, that code file is loaded in one go before processing. The subsequent operations to name the slot clearly take place (otherwise it'd say <mw:mediainfoslotheader /> rather than "Structured data".

@Jdforrester-WMF I don't really know this stuff, but could it be a problem that you are calling getMediaInfoViewRegex before you've defined it?

Sadly, no, that code file is loaded in one go before processing. The subsequent operations to name the slot clearly take place (otherwise it'd say <mw:mediainfoslotheader /> rather than "Structured data".

Is this "<mw:mediainfoview>" even needed for anything at this point? What is it? Can't you remove it entirely for now?

@Jdforrester-WMF I don't really know this stuff, but could it be a problem that you are calling getMediaInfoViewRegex before you've defined it?

Sadly, no, that code file is loaded in one go before processing. The subsequent operations to name the slot clearly take place (otherwise it'd say <mw:mediainfoslotheader /> rather than "Structured data".

Is this "<mw:mediainfoview>" even needed for anything at this point? What is it? Can't you remove it entirely for now?

Patches to re-write the entirety of how MediaWiki works are welcome, but out of scope.

Eurgh. One hot-deploy (on a Saturday night!) later for a stupid bug fix, and it's resolved:

Template div with a table
Screenshot 2019-01-26 at 18.26.14.png (297×1 px, 49 KB)
Heading
Screenshot 2019-01-26 at 18.27.21.png (217×1 px, 25 KB)
Paragraph
image.png (315×1 px, 24 KB)

Sorry for the disruption, all.

Tested in production with adding captions and Babel default language display. Still works as JamesF's screenshot above shows.

Not sure this ticket is the best place to report, but after searching about "mediainfoview", this talk page archive led me here.

I'm encountering a JavaScript error on file description pages:

Error: View mediainfoview does not exist

Tested on Chrome and Firefox, logged in and logged out.

Also, in Preferences > Appearance I unchecked "Show labels, aliases and descriptions in all my languages on page load" to test, but after saving the preferences, the checkbox becomes checked again…