Page MenuHomePhabricator

https://fr.wikipedia.org/wiki/MediaWiki:Common.js makes use of image alt text, which Parsoid doesn't output
Closed, DuplicatePublic

Description

Particularly,

function GeoBox_Init($content) {
	$content.find( 'div.img_toogle' ).each( function ( i, Container ) {
		Container.id = 'img_toogle_' + i;
		var Boxes = $( Container ).find( '.geobox' );
		if (Boxes.length < 2) {
			return;
		}
		var ToggleLinksDiv = document.createElement('ul');
		ToggleLinksDiv.id = 'geoboxToggleLinks_' + i;
		Boxes.each( function ( a, ThisBox ) {
			ThisBox.id = 'geobox_' + i + '_' + a;
			var ThisAlt;
			var ThisImg = ThisBox.getElementsByTagName('img')[0];
			if (ThisImg) {
				ThisAlt = ThisImg.alt;
			}
			if (!ThisAlt) {
				ThisAlt = 'erreur : description non trouvée';
			}
			var toggle = document.createElement('a');
			toggle.id = 'geoboxToggle_' + i + '_' + a;
			toggle.textContent = ThisAlt;
			toggle.href = 'javascript:';
			toggle.onclick = function (e) {
				e.preventDefault();
				GeoBox_Toggle(this);
			};
			var Li = document.createElement('li');
			Li.appendChild(toggle);
			ToggleLinksDiv.appendChild(Li);
			if (a === (Boxes.length - 1)) {
				toggle.style.color = '#888';
				toggle.style.pointerEvents = 'none';
			} else {
				ThisBox.style.display = 'none';
			}
		} );
		Container.appendChild(ToggleLinksDiv);
	} );
}

We could ask them not to do that, but this might not be the only thing relying on the alt attribute so we should investigate further and probably resolve T63566

Event Timeline

For where this is used, see for example "Localisation" in the infobox on https://fr.wikipedia.org/wiki/Bratislava

Arlolra triaged this task as Medium priority.Feb 24 2021, 5:06 PM
Arlolra moved this task from Needs Triage to Media Structure on the Parsoid board.