Page MenuHomePhabricator

Replace tright and tleft with floatright and floatleft in <mapframe>
Open, Needs TriagePublic

Description

The classes tleft and tright were recently deprecated in T426452: [for action] tleft and tright should be replaced with floatleft and floatright if used.

But align="left" still generates tleft in <mapframe>:

image.png (1,711×810 px, 363 KB)

Omitting the align parameter completely outputs tright:

image.png (1,412×627 px, 322 KB)

This may lead to layout bugs, so the classes should be updated to floatleft and floatright.

Event Timeline

Niepodkoloryzowany renamed this task from Replace tright and tleft with floatright and floatleft to Replace tright and tleft with floatright and floatleft in <mapframe>.May 30 2026, 12:47 PM
Niepodkoloryzowany updated the task description. (Show Details)
Izno subscribed.

The output looks like it also didn't get the (Parsoid) figure treatment so it needs correction for that also, and which may be the fundamental issue.

I gave it a try but it's not as easy as it sounds. What Kartographer (intentionally) does is re-creating a piece of HTML that behaves the same as a [[File:…|thumb|left]], for example.

  • floatleft is not the correct replacement because it sets very different margins. I'm not sure for what they are designed for, but they are to small for thumbnails.
  • Replacing tleft with mw-halign-left would be semantically more correct, but currently doesn't work because that CSS class is restricted and works only on <figure> elements. So yes, changing the Kartographer output to produce <figure> is probably a good idea.

Note there is also a little bit of CSS that (again, intentionally) resets floats inside of Leaflet popups. The file leaflet-overrides.less mentions tleft and tright in one place, along with a few other rules related to thumbnails. I suspect these also need updating to work both the old and the new <figure> syntax.

Change #1297714 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Jgiannelos):

[mediawiki/extensions/Kartographer@master] Replace deprecated tleft and tright classes

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

Change #1301776 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/extensions/Kartographer@master] Thumbnail: Switch to figure layout

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

Gave a go at switching to <figure>. It's a bit of a job, as due to cached content, we need both the old and the new html to work with the styles for at least a few weeks.

Of note is also https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Kartographer/+/1293140 by @HakanIST which might be a good idea, but which also needs to be backwards compatible with styling, and it's probably better to do both of these things in succession.