Fix: Contain overflowing images in Main Page templates

The featured-picture and featured-article templates instruct editors to add a left-floated image (File:…) inside a bordered box. When the image is taller than the box's text, the uncleared float overflows past the box's bottom border and bleeds into the sections below, causing the column/section misalignment reported on the Tyap Wikipedia homepage.

Two layers of fix:

  1. containImageOverflow() injects display: flow-root into the outer box of every fetched content template (skipping boxes that already contain their floats, e.g. via overflow:hidden), applied in both the preview and /templates/init paths. flow-root (not overflow:hidden) is used so a wide image is never clipped on narrow/mobile boxes. This makes the box grow to contain the image — the expected behaviour in the task.
  2. generateMainPage wraps the full-width transclusions (featured-picture, single community module, footers) in a display: flow-root div. Since the Main Page is always overwritten on publish, this immediately stops float bleed into subsequent sections even on wikis whose template pages predate the box fix.

Known limitation (same as T429067's navbar fix): /templates/init is create-only, so existing template pages keep their old markup until they are deleted and re-initialised. The main-page wrapper half (layer 2) reaches those wikis regardless, since the Main Page itself is rewritten on every publish.

Co-Authored-By: Claude Opus 4.8

Bug: T429063

Merge request reports

Loading