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

Event Timeline

Ragesoss created this task.Jan 16 2019, 3:25 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 16 2019, 3:25 AM
Ramsey-WMF added a subscriber: Ramsey-WMF.

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 added a subscriber: Jdforrester-WMF.

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.

Jdforrester-WMF moved this task from To Do to Doing on the Structured Data Engineering board.

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".

MB-one added a subscriber: MB-one.Jan 25 2019, 8:50 AM

@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.

4nn1l2 added a subscriber: 4nn1l2.Jan 27 2019, 12:17 AM

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

Template div with a table
Heading
Paragraph

Sorry for the disruption, all.

Ramsey-WMF closed this task as Resolved.Feb 6 2019, 4:57 PM

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